]> git.kaiwu.me - nginx.git/commit
Fixed segfault with incorrect location nesting.
authorMaxim Dounin <mdounin@mdounin.ru>
Fri, 11 Sep 2015 14:04:04 +0000 (17:04 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Fri, 11 Sep 2015 14:04:04 +0000 (17:04 +0300)
commit7930a6c44279315140955fac230cf5305fc3c550
tree34bc04caeccbc47691252f39347b238bb85e3070
parentce05841eefe0e6c5d18ae9b0fb8f9fbd7e99afdd
Fixed segfault with incorrect location nesting.

A configuration with a named location inside a zero-length prefix
or regex location used to trigger a segmentation fault, as
ngx_http_core_location() failed to properly detect if a nested location
was created.  Example configuration to reproduce the problem:

    location "" {
        location @foo {}
    }

Fix is to not rely on a parent location name length, but rather check
command type we are currently parsing.

Identical fix is also applied to ngx_http_rewrite_if(), which used to
incorrectly assume the "if" directive is on server{} level in such
locations.

Reported by Markus Linnala.
Found with afl-fuzz.
src/http/modules/ngx_http_rewrite_module.c
src/http/ngx_http_core_module.c