mirror of
https://github.com/nginx/nginx.git
synced 2025-06-06 00:42:40 +08:00
Fixed segmentation fault in ngx_resolver_create_name_query().
If name passed for resolution was { 0, NULL } (e.g. as a result of name server returning CNAME pointing to ".") pointer wrapped to (void *) -1 resulting in segmentation fault on an attempt to dereference it. Reported by Lanshun Zhou.
This commit is contained in:
parent
6ad02389c3
commit
487ba70126
@ -1834,6 +1834,10 @@ ngx_resolver_create_name_query(ngx_resolver_node_t *rn, ngx_resolver_ctx_t *ctx)
|
||||
p--;
|
||||
*p-- = '\0';
|
||||
|
||||
if (ctx->name.len == 0) {
|
||||
return NGX_DECLINED;
|
||||
}
|
||||
|
||||
for (s = ctx->name.data + ctx->name.len - 1; s >= ctx->name.data; s--) {
|
||||
if (*s != '.') {
|
||||
*p = *s;
|
||||
|
Loading…
Reference in New Issue
Block a user