[nginx] svn commit: r4601 - trunk/src/http

mdounin at mdounin.ru mdounin at mdounin.ru
Thu Apr 19 15:48:03 UTC 2012


Author: mdounin
Date: 2012-04-19 15:48:03 +0000 (Thu, 19 Apr 2012)
New Revision: 4601
URL: http://trac.nginx.org/nginx/changeset/4601/nginx

Log:
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).


Modified:
   trunk/src/http/ngx_http_core_module.c

Modified: trunk/src/http/ngx_http_core_module.c
===================================================================
--- trunk/src/http/ngx_http_core_module.c	2012-04-18 14:47:10 UTC (rev 4600)
+++ trunk/src/http/ngx_http_core_module.c	2012-04-19 15:48:03 UTC (rev 4601)
@@ -1240,7 +1240,7 @@
             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;



More information about the nginx-devel mailing list