mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
Fixed a potential segmentation fault, introduced with recent changes.
This commit is contained in:
@@ -546,6 +546,12 @@ int multipart_init(modsec_rec *msr, char **error_msg) {
|
||||
msr->mpd = (multipart_data *)apr_pcalloc(msr->mp, sizeof(multipart_data));
|
||||
if (msr->mpd == NULL) return -1;
|
||||
|
||||
msr->mpd->parts = apr_array_make(msr->mp, 10, sizeof(multipart_part *));
|
||||
msr->mpd->bufleft = MULTIPART_BUF_SIZE;
|
||||
msr->mpd->bufptr = msr->mpd->buf;
|
||||
msr->mpd->buf_contains_line = 1;
|
||||
msr->mpd->mpp = NULL;
|
||||
|
||||
if (msr->request_content_type == NULL) {
|
||||
*error_msg = apr_psprintf(msr->mp, "Multipart: Content-Type header not available.");
|
||||
return -1;
|
||||
@@ -581,12 +587,6 @@ int multipart_init(modsec_rec *msr, char **error_msg) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
msr->mpd->parts = apr_array_make(msr->mp, 10, sizeof(multipart_part *));
|
||||
msr->mpd->bufleft = MULTIPART_BUF_SIZE;
|
||||
msr->mpd->bufptr = msr->mpd->buf;
|
||||
msr->mpd->buf_contains_line = 1;
|
||||
msr->mpd->mpp = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user