aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2012-06-18 14:06:00 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2012-06-18 14:06:00 +0000
commit40a366c5a8927ad152eec2ab5e65c1a1f70354e4 (patch)
treedc80d2fb273b12cf4dfc1683bf248d8a29814b39 /src
parent859dc4ce015b8706d569350034f04c174cad479d (diff)
downloadnginx-40a366c5a8927ad152eec2ab5e65c1a1f70354e4.tar.gz
nginx-40a366c5a8927ad152eec2ab5e65c1a1f70354e4.zip
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().
Diffstat (limited to 'src')
-rw-r--r--src/core/ngx_hash.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/core/ngx_hash.c b/src/core/ngx_hash.c
index 7d04f7484..b53294502 100644
--- a/src/core/ngx_hash.c
+++ b/src/core/ngx_hash.c
@@ -924,17 +924,6 @@ wildcard:
}
- 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 @@ wildcard:
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;
}