mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Fixed a potential segmentation fault, introduced with recent changes.
This commit is contained in:
parent
7c856eef1f
commit
5898e9e116
@ -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;
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ apr_status_t modsecurity_request_body_store(modsec_rec *msr,
|
||||
if (multipart_process_chunk(msr, data, length, &my_error_msg) < 0) {
|
||||
msr->msc_reqbody_error = 1;
|
||||
msr->msc_reqbody_error_msg = my_error_msg;
|
||||
msr_log(msr, 4, "%s", my_error_msg);
|
||||
msr_log(msr, 1, "Request body processor error: %s", my_error_msg);
|
||||
}
|
||||
}
|
||||
#ifdef WITH_LIBXML2
|
||||
@ -249,7 +249,7 @@ apr_status_t modsecurity_request_body_store(modsec_rec *msr,
|
||||
if (xml_process_chunk(msr, data, length, &my_error_msg) < 0) {
|
||||
msr->msc_reqbody_error = 1;
|
||||
msr->msc_reqbody_error_msg = my_error_msg;
|
||||
msr_log(msr, 4, "%s", my_error_msg);
|
||||
msr_log(msr, 4, "Request body processor error: %s", my_error_msg);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user