Klaus Demo nginx / bffbbeb
In ngx_ptocidr(), check that the supplied prefix length is within the allowed range. Ruslan Ermilov 10 years ago
1 changed file(s) with 7 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
406406
407407 #if (NGX_HAVE_INET6)
408408 case AF_INET6:
409 if (shift > 128) {
410 return NGX_ERROR;
411 }
412
409413 addr = cidr->u.in6.addr.s6_addr;
410414 mask = cidr->u.in6.mask.s6_addr;
411415 rc = NGX_OK;
427431 #endif
428432
429433 default: /* AF_INET */
434 if (shift > 32) {
435 return NGX_ERROR;
436 }
430437
431438 if (shift) {
432439 cidr->u.in.mask = htonl((ngx_uint_t) (0 - (1 << (32 - shift))));