Skip to content

Commit a96b557

Browse files
committed
Add NULL check for multipart boundary in multipart_complete
This check is added to satisfy SonarQube Cloud Quality Gate on CI. owasp-modsecurity#3483 (comment)
1 parent 0bfb828 commit a96b557

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

apache2/msc_multipart.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,11 @@ int multipart_complete(modsec_rec *msr, char **error_msg) {
10231023
* processed yet) in the buffer.
10241024
*/
10251025
if (msr->mpd->buf_contains_line) {
1026+
if (msr->mpd->boundary == NULL) {
1027+
*error_msg = apr_psprintf(msr->mp, "Multipart: BUG: multipart_complete must not be called if multipart_init returns an error.");
1028+
return -1;
1029+
}
1030+
10261031
/*
10271032
* Note that the buffer may end with the final boundary followed by only CR,
10281033
* coming from the [CRLF epilogue], when allow_process_partial == 1 (which is

0 commit comments

Comments
 (0)