Resolver: added missing sanity checking when creating name queries.

Found by Veracode.
This commit is contained in:
Maxim Dounin 2012-03-22 11:57:18 +00:00
parent 8e6728ef13
commit e34ff16f67

View File

@ -1840,7 +1840,7 @@ ngx_resolver_create_name_query(ngx_resolver_node_t *rn, ngx_resolver_ctx_t *ctx)
len++;
} else {
if (len == 0) {
if (len == 0 || len > 255) {
return NGX_DECLINED;
}
@ -1851,6 +1851,10 @@ ngx_resolver_create_name_query(ngx_resolver_node_t *rn, ngx_resolver_ctx_t *ctx)
p--;
}
if (len == 0 || len > 255) {
return NGX_DECLINED;
}
*p = (u_char) len;
return NGX_OK;