浏览代码

Skip leading .. in remove_double_dots_and_double_slashes

See #327. There was not really a directory disclosure before, since a request to .. will fail already in process_new_connection with error "Invalid URI: [..]".
bel 9 年之前
父节点
当前提交
5f13e9894b
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/civetweb.c

+ 4 - 0
src/civetweb.c

@@ -5286,6 +5286,10 @@ remove_double_dots_and_double_slashes(char *s)
 {
 	char *p = s;
 
+    while ((s[0] == '.') && (s[1] == '.')) {
+        s++;
+    }
+
 	while (*s != '\0') {
 		*p++ = *s++;
 		if (s[-1] == '/' || s[-1] == '\\') {