Browse Source

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 years ago
parent
commit
5f13e9894b
1 changed files with 4 additions and 0 deletions
  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;
 	char *p = s;
 
 
+    while ((s[0] == '.') && (s[1] == '.')) {
+        s++;
+    }
+
 	while (*s != '\0') {
 	while (*s != '\0') {
 		*p++ = *s++;
 		*p++ = *s++;
 		if (s[-1] == '/' || s[-1] == '\\') {
 		if (s[-1] == '/' || s[-1] == '\\') {