# HG changeset patch # User Maxim Dounin # Date 1334850483 0 # Node ID f1a7633b20a4219a4cda9d5e36bfae624c49d9a9 # Parent f947296f6b2b78e78f546fbd90ef21194583d5b6 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). diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c --- 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_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;