mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-28 19:18:32 +08:00
fixed bug #46072: ip4addr_aton() does not check the number range of all address parts
This commit is contained in:
@@ -230,6 +230,9 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
|
||||
if (val > 0xffffffUL) {
|
||||
return 0;
|
||||
}
|
||||
if (parts[0] > 0xff) {
|
||||
return 0;
|
||||
}
|
||||
val |= parts[0] << 24;
|
||||
break;
|
||||
|
||||
@@ -237,6 +240,9 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
|
||||
if (val > 0xffff) {
|
||||
return 0;
|
||||
}
|
||||
if ((parts[0] > 0xff) || (parts[1] > 0xff)) {
|
||||
return 0;
|
||||
}
|
||||
val |= (parts[0] << 24) | (parts[1] << 16);
|
||||
break;
|
||||
|
||||
@@ -244,6 +250,9 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
|
||||
if (val > 0xff) {
|
||||
return 0;
|
||||
}
|
||||
if ((parts[0] > 0xff) || (parts[1] > 0xff) || (parts[2] > 0xff)) {
|
||||
return 0;
|
||||
}
|
||||
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user