diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2012-04-19 15:48:03 +0000 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2012-04-19 15:48:03 +0000 |
commit | e8fe3ce0981aec98fc74382515765b373f072e07 (patch) | |
tree | 36d06da9adeba2391855c96972b3f5a8f1de26d8 /src | |
parent | a73ce28e0a6d855daaf2cd2a40bbf65762e58f2a (diff) | |
download | nginx-e8fe3ce0981aec98fc74382515765b373f072e07.tar.gz nginx-e8fe3ce0981aec98fc74382515765b373f072e07.zip |
Fixed segfault with try_files (ticket #152).
The problem occured if first uri in try_files was shorter than request uri,
resulting in reserve being 0 and hence allocation skipped. The bug was
introduced in r4584 (1.1.19).
Diffstat (limited to 'src')
-rw-r--r-- | src/http/ngx_http_core_module.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 5b7f44aa1..42dd6644e 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -1240,7 +1240,7 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r, reserve = len > r->uri.len - alias ? len - (r->uri.len - alias) : 0; } - if (reserve > allocated) { + if (reserve > allocated || !allocated) { /* 16 bytes are preallocation */ allocated = reserve + 16; |