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

Maxim Dounin mdounin at mdounin.ru
Fri Aug 23 18:20:05 UTC 2013


details:   http://hg.nginx.org/nginx/rev/ee2a4c68fb35
branches:  
changeset: 5339:ee2a4c68fb35
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
@@ -4766,7 +4766,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