]> git.kaiwu.me - nginx.git/commitdiff
handle "/../" case more reliably
authorIgor Sysoev <igor@sysoev.ru>
Mon, 14 Sep 2009 07:42:01 +0000 (07:42 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Mon, 14 Sep 2009 07:42:01 +0000 (07:42 +0000)
src/http/ngx_http_parse.c

index 9865564e5e55788ea2a2a05186e51e57d4975ce2..d2abaa708765b75b597ad0f66118f6907fa80004 100644 (file)
@@ -1134,11 +1134,15 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
 #endif
             case '/':
                 state = sw_slash;
-                u -= 4;
-                if (u < r->uri.data) {
-                    return NGX_HTTP_PARSE_INVALID_REQUEST;
-                }
-                while (*(u - 1) != '/') {
+                u -= 5;
+                for ( ;; ) {
+                    if (u < r->uri.data) {
+                        return NGX_HTTP_PARSE_INVALID_REQUEST;
+                    }
+                    if (*u == '/') {
+                        u++;
+                        break;
+                    }
                     u--;
                 }
                 break;