comparison src/core/ngx_hash.c @ 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 3b6d69857de2
children 7fc16ff7ddc4
comparison
equal deleted inserted replaced
6244:055d1f63960a 6245:3cf25d33886a
741 } 741 }
742 742
743 if (key->data[i] == '.' && key->data[i + 1] == '.') { 743 if (key->data[i] == '.' && key->data[i + 1] == '.') {
744 return NGX_DECLINED; 744 return NGX_DECLINED;
745 } 745 }
746
747 if (key->data[i] == '\0') {
748 return NGX_DECLINED;
749 }
746 } 750 }
747 751
748 if (key->len > 1 && key->data[0] == '.') { 752 if (key->len > 1 && key->data[0] == '.') {
749 skip = 1; 753 skip = 1;
750 goto wildcard; 754 goto wildcard;