@@ -434,8 +434,8 @@ apr_status_t modsecurity_request_body_to_stream(modsec_rec *msr, const char *buf
434434if (msr -> stream_input_data == NULL ) {
435435// Is the request body length known beforehand? (requests that are not Transfer-Encoding: chunked)
436436if (msr -> request_content_length > 0 ) {
437- // Use min of Content-Length and SecRequestBodyLimit
438- allocate_length = min ( msr -> request_content_length , msr -> txcfg -> reqbody_limit ) ;
437+ // Use min of Content-Length and SecRequestBodyLimit
438+ allocate_length = msr -> request_content_length < msr -> txcfg -> reqbody_limit ? msr -> request_content_length : msr -> txcfg -> reqbody_limit ;
439439 }
440440else {
441441// We don't know how this request is going to be, so hope for just buflen to begin with (requests that are Transfer-Encoding: chunked)
@@ -483,7 +483,7 @@ apr_status_t modsecurity_request_body_to_stream(modsec_rec *msr, const char *buf
483483
484484// Append buffer to msr->stream_input_data
485485memcpy (msr -> stream_input_data + msr -> stream_input_length ,buffer ,buflen );
486- msr -> stream_input_length += buflen ;
486+ msr -> stream_input_length += buflen ;
487487
488488return 1 ;
489489}