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 1a5d0be..151e643 100644
--- a/src/core/ngx_hash.c
+++ b/src/core/ngx_hash.c
@@ -743,6 +743,10 @@
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] == '.') {