changeset 6245:3cf25d33886a

Core: fixed segfault with null in wildcard hash names. A configuration like server { server_name .foo^@; } server { server_name .foo; } resulted in a segmentation fault during construction of server names hash. Reported by Markus Linnala. Found with afl-fuzz.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 11 Sep 2015 17:04:40 +0300
parents 055d1f63960a
children 257b51c37c5a
files src/core/ngx_hash.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/ngx_hash.c
+++ b/src/core/ngx_hash.c
@@ -743,6 +743,10 @@ ngx_hash_add_key(ngx_hash_keys_arrays_t 
             if (key->data[i] == '.' && key->data[i + 1] == '.') {
                 return NGX_DECLINED;
             }
+
+            if (key->data[i] == '\0') {
+                return NGX_DECLINED;
+            }
         }
 
         if (key->len > 1 && key->data[0] == '.') {