aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_request.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2012-06-05 13:38:27 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2012-06-05 13:38:27 +0000
commit0d7720ddc052d5bf8aa09485a2a6bb9004bb943d (patch)
tree0b1f9acc0b9af9a976ac3ee84ec70e107d8b2709 /src/http/ngx_http_request.c
parentf83598a35981197ac113b9c898bdb972aa8366da (diff)
downloadnginx-0d7720ddc052d5bf8aa09485a2a6bb9004bb943d.tar.gz
nginx-0d7720ddc052d5bf8aa09485a2a6bb9004bb943d.zip
Win32: uris with ":$" are now rejected.
There are too many problems with special NTFS streams, notably "::$data", "::$index_allocation" and ":$i30:$index_allocation". For now we don't reject all URIs with ":" like Apache does as there are no good reasons seen yet, and there are multiple programs using it in URLs (e.g. MediaWiki).
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r--src/http/ngx_http_request.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 06f89d648..b1877131c 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -812,7 +812,28 @@ ngx_http_process_request_line(ngx_event_t *rev)
#if (NGX_WIN32)
{
- u_char *p;
+ u_char *p, *last;
+
+ p = r->uri.data;
+ last = r->uri.data + r->uri.len;
+
+ while (p < last) {
+
+ if (*p++ == ':') {
+
+ /*
+ * this check covers "::$data", "::$index_allocation" and
+ * ":$i30:$index_allocation"
+ */
+
+ if (p < last && *p == '$') {
+ ngx_log_error(NGX_LOG_INFO, c->log, 0,
+ "client sent unsafe win32 URI");
+ ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
+ return;
+ }
+ }
+ }
p = r->uri.data + r->uri.len - 1;
@@ -828,11 +849,6 @@ ngx_http_process_request_line(ngx_event_t *rev)
continue;
}
- if (ngx_strncasecmp(p - 6, (u_char *) "::$data", 7) == 0) {
- p -= 7;
- continue;
- }
-
break;
}