fix resolving an empty name (".")

This commit is contained in:
Igor Sysoev 2009-11-11 14:27:24 +00:00
parent 61da56d041
commit e79f429b4b

View File

@ -1719,13 +1719,14 @@ static ngx_int_t
ngx_resolver_create_name_query(ngx_resolver_node_t *rn, ngx_resolver_ctx_t *ctx)
{
u_char *p, *s;
size_t len;
size_t len, nlen;
ngx_uint_t ident;
ngx_resolver_qs_t *qs;
ngx_resolver_query_t *query;
len = sizeof(ngx_resolver_query_t)
+ 1 + ctx->name.len + 1 + sizeof(ngx_resolver_qs_t);
nlen = ctx->name.len ? (1 + ctx->name.len + 1) : 1;
len = sizeof(ngx_resolver_query_t) + nlen + sizeof(ngx_resolver_qs_t);
p = ngx_resolver_calloc(ctx->resolver, len);
if (p == NULL) {
@ -1754,8 +1755,7 @@ ngx_resolver_create_name_query(ngx_resolver_node_t *rn, ngx_resolver_ctx_t *ctx)
query->nns_hi = 0; query->nns_lo = 0;
query->nar_hi = 0; query->nar_lo = 0;
p += sizeof(ngx_resolver_query_t)
+ ctx->name.len ? (1 + ctx->name.len + 1) : 1;
p += sizeof(ngx_resolver_query_t) + nlen;
qs = (ngx_resolver_qs_t *) p;