diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/ngx_inet.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c index cfc06e48d..a6ce9f395 100644 --- a/src/core/ngx_inet.c +++ b/src/core/ngx_inet.c @@ -407,6 +407,10 @@ ngx_ptocidr(ngx_str_t *text, ngx_cidr_t *cidr) #if (NGX_HAVE_INET6) case AF_INET6: + if (shift > 128) { + return NGX_ERROR; + } + addr = cidr->u.in6.addr.s6_addr; mask = cidr->u.in6.mask.s6_addr; rc = NGX_OK; @@ -428,6 +432,9 @@ ngx_ptocidr(ngx_str_t *text, ngx_cidr_t *cidr) #endif default: /* AF_INET */ + if (shift > 32) { + return NGX_ERROR; + } if (shift) { cidr->u.in.mask = htonl((ngx_uint_t) (0 - (1 << (32 - shift)))); |