# HG changeset patch # User Maxim Dounin # Date 1441980280 -10800 # Node ID 3cf25d33886a8f025c98ffc4bd37a28c7cfd904a # Parent 055d1f63960aa8d0a1843ab75b7156fe61c7295f 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 --- 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] == '.') {