diff src/http/ngx_http_parse.c @ 124:12acc273e340 NGINX_0_3_9

nginx 0.3.9 *) Bugfix: nginx considered URI as unsafe if two any symbols was between two slashes; bug appeared in 0.3.8.
author Igor Sysoev <http://sysoev.ru>
date Thu, 10 Nov 2005 00:00:00 +0300
parents d25a1d6034f1
children df17fbafec8f
line wrap: on
line diff
--- a/src/http/ngx_http_parse.c
+++ b/src/http/ngx_http_parse.c
@@ -1056,7 +1056,7 @@ ngx_http_parse_unsafe_uri(ngx_http_reque
 
             /* detect "/../" */
 
-            if (p[2] == '/') {
+            if (p[0] == '.' && p[1] == '.' && p[2] == '/') {
                 goto unsafe;
             }
 
@@ -1070,7 +1070,9 @@ ngx_http_parse_unsafe_uri(ngx_http_reque
 
                 /* detect "/.../" */
 
-                if (p[3] == '/' || p[3] == '\\') {
+                if (p[0] == '.' && p[1] == '.' && p[2] == '.'
+                    && (p[3] == '/' || p[3] == '\\'))
+                {
                     goto unsafe;
                 }
             }