diff options
author | Igor Sysoev <igor@sysoev.ru> | 2009-09-14 07:42:01 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2009-09-14 07:42:01 +0000 |
commit | 97aa4c86a1e6b70f3d48bc9ddad921cbee7ceea5 (patch) | |
tree | a03451a18c700550ff3d77a4ed2479782d7e8449 | |
parent | 12a7d493d49efacd88c1a0dd0bb2e5b4216a801f (diff) | |
download | nginx-97aa4c86a1e6b70f3d48bc9ddad921cbee7ceea5.tar.gz nginx-97aa4c86a1e6b70f3d48bc9ddad921cbee7ceea5.zip |
handle "/../" case more reliably
-rw-r--r-- | src/http/ngx_http_parse.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c index 9865564e5..d2abaa708 100644 --- a/src/http/ngx_http_parse.c +++ b/src/http/ngx_http_parse.c @@ -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; |