From: Valentin Bartenev Date: Tue, 28 Apr 2015 15:55:03 +0000 (+0300) Subject: Fixed overflow detection in ngx_inet_addr(). X-Git-Tag: release-1.9.1~20 X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=89ad9ea30946dacb2fcf088a97f5a40d3b408d2c;p=nginx.git 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 2c84daf6e..96a04fded 100644 --- a/src/core/ngx_inet.c +++ b/src/core/ngx_inet.c @@ -26,15 +26,15 @@ ngx_inet_addr(u_char *text, size_t len) 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; }