Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit24987bf

Browse files
committed
Less strict multipart parsing
1 parent13b32aa commit24987bf

File tree

1 file changed

+20
-33
lines changed

1 file changed

+20
-33
lines changed

‎apache2/msc_multipart.c‎

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -695,42 +695,29 @@ static int multipart_boundary_characters_valid(char *boundary) {
695695

696696
if (p==NULL)return-1;
697697

698-
while((c=*p)!='\0') {
699-
/* Control characters and space not allowed. */
700-
if (c<32) {
698+
while ((c=*p)!='\0') {
699+
// Check against allowed list defined in RFC2046 page 21
700+
if (!(
701+
('0' <=c&&c <='9')
702+
|| ('A' <=c&&c <='Z')
703+
|| ('a' <=c&&c <='z')
704+
|| (c==' '&&*(p+1)!='\0')// space allowed, but not as last character
705+
||c=='\''
706+
||c=='('
707+
||c==')'
708+
||c=='+'
709+
||c=='_'
710+
||c==','
711+
||c=='-'
712+
||c=='.'
713+
||c=='/'
714+
||c==':'
715+
||c=='='
716+
||c=='?'
717+
)) {
701718
return0;
702719
}
703720

704-
/* Non-ASCII characters not allowed. */
705-
if (c>126) {
706-
return0;
707-
}
708-
709-
switch(c) {
710-
/* Special characters not allowed. */
711-
case'(' :
712-
case')' :
713-
case'<' :
714-
case'>' :
715-
case'@' :
716-
case',' :
717-
case';' :
718-
case':' :
719-
case'\\' :
720-
case'"' :
721-
case'/' :
722-
case'[' :
723-
case']' :
724-
case'?' :
725-
case'=' :
726-
return0;
727-
break;
728-
729-
default :
730-
/* Do nothing. */
731-
break;
732-
}
733-
734721
p++;
735722
}
736723

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp