]> git.kaiwu.me - nginx.git/commitdiff
fix trailing wildcard when two or more listen used in one server
authorIgor Sysoev <igor@sysoev.ru>
Fri, 24 Aug 2007 11:05:47 +0000 (11:05 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 24 Aug 2007 11:05:47 +0000 (11:05 +0000)
src/core/ngx_hash.c

index 911781f4bfa4b41a98b91d5cd391821e18f471d6..f0c167eafac2260c356b8021065f888946e53b23 100644 (file)
@@ -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];
     }