mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-16 07:56:12 +03:00
Less strict multipart parsing
This commit is contained in:
parent
b600669d02
commit
7af8363fd4
@ -696,41 +696,28 @@ static int multipart_boundary_characters_valid(char *boundary) {
|
|||||||
if (p == NULL) return -1;
|
if (p == NULL) return -1;
|
||||||
|
|
||||||
while ((c = *p) != '\0') {
|
while ((c = *p) != '\0') {
|
||||||
/* Control characters and space not allowed. */
|
// Check against allowed list defined in RFC2046 page 21
|
||||||
if (c < 32) {
|
if (!(
|
||||||
|
('0' <= c && c <= '9')
|
||||||
|
|| ('A' <= c && c <= 'Z')
|
||||||
|
|| ('a' <= c && c <= 'z')
|
||||||
|
|| (c == ' ' && *(p + 1) != '\0') // space allowed, but not as last character
|
||||||
|
|| c == '\''
|
||||||
|
|| c == '('
|
||||||
|
|| c == ')'
|
||||||
|
|| c == '+'
|
||||||
|
|| c == '_'
|
||||||
|
|| c == ','
|
||||||
|
|| c == '-'
|
||||||
|
|| c == '.'
|
||||||
|
|| c == '/'
|
||||||
|
|| c == ':'
|
||||||
|
|| c == '='
|
||||||
|
|| c == '?'
|
||||||
|
)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Non-ASCII characters not allowed. */
|
|
||||||
if (c > 126) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(c) {
|
|
||||||
/* Special characters not allowed. */
|
|
||||||
case '(' :
|
|
||||||
case ')' :
|
|
||||||
case '<' :
|
|
||||||
case '>' :
|
|
||||||
case '@' :
|
|
||||||
case ',' :
|
|
||||||
case ';' :
|
|
||||||
case ':' :
|
|
||||||
case '\\' :
|
|
||||||
case '"' :
|
|
||||||
case '/' :
|
|
||||||
case '[' :
|
|
||||||
case ']' :
|
|
||||||
case '?' :
|
|
||||||
case '=' :
|
|
||||||
return 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default :
|
|
||||||
/* Do nothing. */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user