Fixed overflow detection in ngx_inet_addr(). Overflow detection of the last octet might not work. Reported by Sergey Polovko.
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c index 2c84daf..96a04fd 100644 --- a/src/core/ngx_inet.c +++ b/src/core/ngx_inet.c
@@ -26,15 +26,15 @@ n = 0; for (p = text; p < text + len; p++) { - - if (octet > 255) { - return INADDR_NONE; - } - c = *p; if (c >= '0' && c <= '9') { octet = octet * 10 + (c - '0'); + + if (octet > 255) { + return INADDR_NONE; + } + continue; }