fixed bug #46072: ip4addr_aton() does not check the number range of all address parts

This commit is contained in:
goldsimon 2015-09-30 14:15:36 +02:00
parent f89e859415
commit 927b72abd2
2 changed files with 13 additions and 0 deletions

View File

@ -274,6 +274,10 @@ HISTORY
++ Bugfixes: ++ Bugfixes:
2015-09-30: Simon Goldschmidt
* ip4_addr.c: fixed bug #46072: ip4addr_aton() does not check the number range
of all address parts
2015-08-28: Simon Goldschmidt 2015-08-28: Simon Goldschmidt
* tcp.c, tcp_in.c: fixed bug #44023: TCP ssthresh value is unclear: ssthresh * tcp.c, tcp_in.c: fixed bug #44023: TCP ssthresh value is unclear: ssthresh
is set to the full send window for active open, too, and is updated once is set to the full send window for active open, too, and is updated once

View File

@ -230,6 +230,9 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
if (val > 0xffffffUL) { if (val > 0xffffffUL) {
return 0; return 0;
} }
if (parts[0] > 0xff) {
return 0;
}
val |= parts[0] << 24; val |= parts[0] << 24;
break; break;
@ -237,6 +240,9 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
if (val > 0xffff) { if (val > 0xffff) {
return 0; return 0;
} }
if ((parts[0] > 0xff) || (parts[1] > 0xff)) {
return 0;
}
val |= (parts[0] << 24) | (parts[1] << 16); val |= (parts[0] << 24) | (parts[1] << 16);
break; break;
@ -244,6 +250,9 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
if (val > 0xff) { if (val > 0xff) {
return 0; return 0;
} }
if ((parts[0] > 0xff) || (parts[1] > 0xff) || (parts[2] > 0xff)) {
return 0;
}
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
break; break;
default: default: