Mercurial > hg > nginx
changeset 4689:d2ed9fee092b
Fixed handling of conflicting wildcard server names.
With previous code wildcard names were added to hash even if conflict
was detected. This resulted in identical names in hash and segfault
later in ngx_hash_wildcard_init().
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 18 Jun 2012 14:06:00 +0000 |
parents | 5fedb27c3e36 |
children | d91f3c78603e |
files | src/core/ngx_hash.c |
diffstat | 1 files changed, 13 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/ngx_hash.c Mon Jun 18 14:02:20 2012 +0000 +++ b/src/core/ngx_hash.c Mon Jun 18 14:06:00 2012 +0000 @@ -924,17 +924,6 @@ } - hk = ngx_array_push(hwc); - if (hk == NULL) { - return NGX_ERROR; - } - - hk->key.len = last - 1; - hk->key.data = p; - hk->key_hash = 0; - hk->value = value; - - /* check conflicts in wildcard hash */ name = keys->elts; @@ -972,5 +961,18 @@ ngx_memcpy(name->data, key->data + skip, name->len); + + /* add to wildcard hash */ + + hk = ngx_array_push(hwc); + if (hk == NULL) { + return NGX_ERROR; + } + + hk->key.len = last - 1; + hk->key.data = p; + hk->key_hash = 0; + hk->value = value; + return NGX_OK; }