From: Maxim Dounin Date: Fri, 11 Sep 2015 14:04:40 +0000 (+0300) Subject: Core: fixed segfault with null in wildcard hash names. X-Git-Tag: release-1.9.5~7 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/postgres_fdw.c?a=commitdiff_plain;h=2c9691431229bfe33e81c5a03a70792548b28e22;p=nginx.git 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. --- 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] == '.') {