comparison src/http/ngx_http_core_module.c @ 4600:f1a7633b20a4

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).
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 19 Apr 2012 15:48:03 +0000
parents a1d5842064f7
children 347a54b2cb14
comparison
equal deleted inserted replaced
4599:f947296f6b2b 4600:f1a7633b20a4
1238 1238
1239 } else { 1239 } else {
1240 reserve = len > r->uri.len - alias ? len - (r->uri.len - alias) : 0; 1240 reserve = len > r->uri.len - alias ? len - (r->uri.len - alias) : 0;
1241 } 1241 }
1242 1242
1243 if (reserve > allocated) { 1243 if (reserve > allocated || !allocated) {
1244 1244
1245 /* 16 bytes are preallocation */ 1245 /* 16 bytes are preallocation */
1246 allocated = reserve + 16; 1246 allocated = reserve + 16;
1247 1247
1248 if (ngx_http_map_uri_to_path(r, &path, &root, allocated) == NULL) { 1248 if (ngx_http_map_uri_to_path(r, &path, &root, allocated) == NULL) {