Latest update - 7579

This commit is contained in:
2019-10-09 22:16:35 +09:00
parent 97092a7563
commit 8b760dce84
+37 -7
View File
@@ -1437,9 +1437,11 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
state = sw_quoted; state = sw_quoted;
break; break;
case '?': case '?':
u--;
r->args_start = p; r->args_start = p;
goto args; goto args;
case '#': case '#':
u--;
goto done; goto done;
case '+': case '+':
r->plus_in_uri = 1; r->plus_in_uri = 1;
@@ -1467,8 +1469,9 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
case '\\': case '\\':
#endif #endif
case '/': case '/':
state = sw_slash; case '?':
u -= 5; case '#':
u -= 4;
for ( ;; ) { for ( ;; ) {
if (u < r->uri.data) { if (u < r->uri.data) {
return NGX_HTTP_PARSE_INVALID_REQUEST; return NGX_HTTP_PARSE_INVALID_REQUEST;
@@ -1479,16 +1482,19 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
} }
u--; u--;
} }
if (ch == '?') {
r->args_start = p;
goto args;
}
if (ch == '#') {
goto done;
}
state = sw_slash;
break; break;
case '%': case '%':
quoted_state = state; quoted_state = state;
state = sw_quoted; state = sw_quoted;
break; break;
case '?':
r->args_start = p;
goto args;
case '#':
goto done;
case '+': case '+':
r->plus_in_uri = 1; r->plus_in_uri = 1;
/* fall through */ /* fall through */
@@ -1561,6 +1567,30 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
} }
} }
if (state == sw_quoted || state == sw_quoted_second) {
return NGX_HTTP_PARSE_INVALID_REQUEST;
}
if (state == sw_dot) {
u--;
} else if (state == sw_dot_dot) {
u -= 4;
for ( ;; ) {
if (u < r->uri.data) {
return NGX_HTTP_PARSE_INVALID_REQUEST;
}
if (*u == '/') {
u++;
break;
}
u--;
}
}
done: done:
r->uri.len = u - r->uri.data; r->uri.len = u - r->uri.data;