[nginx] Fixed try_files with empty argument (ticket #390).

Maxim Dounin mdounin at mdounin.ru
Tue Oct 8 12:12:34 UTC 2013


details:   http://hg.nginx.org/nginx/rev/ddf740b9fdf6
branches:  stable-1.4
changeset: 5416:ddf740b9fdf6
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Fri Aug 23 22:18:39 2013 +0400
description:
Fixed try_files with empty argument (ticket #390).

diffstat:

 src/http/ngx_http_core_module.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (14 lines):

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
@@ -4758,7 +4758,9 @@ ngx_http_core_try_files(ngx_conf_t *cf, 
 
         tf[i].name = value[i + 1];
 
-        if (tf[i].name.data[tf[i].name.len - 1] == '/') {
+        if (tf[i].name.len > 0
+            && tf[i].name.data[tf[i].name.len - 1] == '/')
+        {
             tf[i].test_dir = 1;
             tf[i].name.len--;
             tf[i].name.data[tf[i].name.len] = '\0';



More information about the nginx-devel mailing list