diff src/core/ngx_hash.c @ 1415:d83687d29853

fix trailing wildcard when two or more listen used in one server
author Igor Sysoev <igor@sysoev.ru>
date Fri, 24 Aug 2007 11:05:47 +0000
parents 8ef04207c84f
children 22fb8f72d3e7
line wrap: on
line diff
--- 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];
     }