changeset 5339:ee2a4c68fb35

Fixed try_files with empty argument (ticket #390).
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 23 Aug 2013 22:18:39 +0400
parents 010bb2e21f3f
children 13a5f4765887
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	Fri Aug 23 16:24:24 2013 +0400
+++ b/src/http/ngx_http_core_module.c	Fri Aug 23 22:18:39 2013 +0400
@@ -4766,7 +4766,9 @@
 
         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';