changeset 5416:ddf740b9fdf6 stable-1.4

Fixed try_files with empty argument (ticket #390).
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 23 Aug 2013 22:18:39 +0400
parents f7e8e6bd5379
children 3169a9b2250d
files src/http/ngx_http_core_module.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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';