Skip to content

Commit c4e682a

Browse files
authored
Avoid use of min-macro, as it is not available in all envs (microsoft#5)
1 parent f98a101 commit c4e682a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

apache2/msc_reqbody.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ apr_status_t modsecurity_request_body_to_stream(modsec_rec *msr, const char *buf
434434
if (msr->stream_input_data == NULL) {
435435
// Is the request body length known beforehand? (requests that are not Transfer-Encoding: chunked)
436436
if (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
}
440440
else {
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
485485
memcpy(msr->stream_input_data + msr->stream_input_length, buffer, buflen);
486-
msr->stream_input_length += buflen;
486+
msr->stream_input_length += buflen;
487487

488488
return 1;
489489
}

0 commit comments

Comments
 (0)