From 2c9691431229bfe33e81c5a03a70792548b28e22 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Fri, 11 Sep 2015 17:04:40 +0300 Subject: 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. --- src/core/ngx_hash.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/core/ngx_hash.c b/src/core/ngx_hash.c index 1a5d0be2e..151e64304 100644 --- 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 *ha, ngx_str_t *key, void *value, 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] == '.') { -- cgit