Skip to content

Commit f27c85c

Browse files
committed
Check if the MP header contains invalid character
1 parent 935e68c commit f27c85c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

apache2/msc_multipart.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ static int multipart_process_part_header(modsec_rec *msr, char **error_msg) {
402402
if (msr->mpd->mpp->last_header_line != NULL) {
403403
*(char **)apr_array_push(msr->mpd->mpp->header_lines) = msr->mpd->mpp->last_header_line;
404404
msr_log(msr, 9, "Multipart: Added part header line \"%s\"", msr->mpd->mpp->last_header_line);
405-
}
405+
}
406406

407407
data = msr->mpd->buf;
408408

@@ -424,6 +424,16 @@ static int multipart_process_part_header(modsec_rec *msr, char **error_msg) {
424424
return -1;
425425
}
426426

427+
/* check if multipart header contains any invalid characters */
428+
char *ch = header_name;
429+
while(*ch != '\0') {
430+
if (*ch < 33 || *ch > 126) {
431+
*error_msg = apr_psprintf(msr->mp, "Multipart: Invalid part header (contains invalid character).");
432+
return -1;
433+
}
434+
ch++;
435+
}
436+
427437
/* extract the value value */
428438
data++;
429439
while((*data == '\t') || (*data == ' ')) data++;

0 commit comments

Comments
 (0)