# HG changeset patch # User Igor Sysoev # Date 1187953547 0 # Node ID d83687d298533505dd255281481a91093292d6d1 # Parent be1e56a892d8c1ba61d3b8b47a032b6fe3b65509 fix trailing wildcard when two or more listen used in one server diff --git a/src/core/ngx_hash.c b/src/core/ngx_hash.c --- a/src/core/ngx_hash.c +++ b/src/core/ngx_hash.c @@ -889,10 +889,15 @@ wildcard: /* convert "www.example.*" to "www.example\0" */ - p = key->data; - key->data[last] = '\0'; last++; + p = ngx_palloc(ha->temp_pool, last); + if (p == NULL) { + return NGX_ERROR; + } + + ngx_cpystrn(p, key->data, last - 1); + hwc = &ha->dns_wc_tail; keys = &ha->dns_wc_tail_hash[k]; }