@@ -428,29 +428,29 @@ apr_status_t modsecurity_request_body_store(modsec_rec *msr,
428428}
429429
430430apr_status_t modsecurity_request_body_to_stream (modsec_rec * msr ,const char * buffer ,int buflen ,char * * error_msg ) {
431- apr_size_t allocate ;
432- char * allocated ;
431+ apr_size_t allocate_length = 0 ;
432+ char * allocated = NULL ;
433433
434434if (msr -> stream_input_data == NULL ) {
435435// Is the request body length is known beforehand? (requests that are not Transfer-Encoding: chunked)
436436if (msr -> request_content_length > 0 ) {
437- allocate = msr -> request_content_length ;
437+ allocate_length = msr -> request_content_length ;
438438 }
439439else {
440440// 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)
441- allocate = buflen ;
441+ allocate_length = buflen ;
442442 }
443443
444- allocated = (char * )calloc (allocate ,sizeof (char ));
444+ allocated = (char * )calloc (allocate_length ,sizeof (char ));
445445if (allocated ) {
446446msr -> stream_input_data = allocated ;
447- msr -> stream_input_allocated_length = allocate ;
447+ msr -> stream_input_allocated_length = allocate_length ;
448448 }
449449else {
450450* error_msg = apr_psprintf (
451451msr -> mp ,
452452"Unable to allocate memory to hold request body on stream. Asked for %" APR_SIZE_T_FMT " bytes." ,
453- allocate );
453+ allocate_length );
454454return -1 ;
455455 }
456456 }
@@ -459,18 +459,18 @@ apr_status_t modsecurity_request_body_to_stream(modsec_rec *msr, const char *buf
459459if ((msr -> stream_input_length + buflen )> msr -> stream_input_allocated_length ) {
460460
461461// If this becomes a hotspot again, consider increasing by some percent extra each time, for fewer reallocs
462- allocate = msr -> stream_input_length + buflen ;
462+ allocate_length = msr -> stream_input_length + buflen ;
463463
464- allocated = (char * )realloc (msr -> stream_input_data ,allocate );
464+ allocated = (char * )realloc (msr -> stream_input_data ,allocate_length );
465465if (allocated ) {
466466msr -> stream_input_data = allocated ;
467- msr -> stream_input_allocated_length = allocate ;
467+ msr -> stream_input_allocated_length = allocate_length ;
468468 }
469469else {
470470* error_msg = apr_psprintf (
471471msr -> mp ,
472472"Unable to reallocate memory to hold request body on stream. Asked for %" APR_SIZE_T_FMT " bytes." ,
473- allocate );
473+ allocate_length );
474474free (msr -> stream_input_data );
475475return -1 ;
476476 }
@@ -891,15 +891,15 @@ apr_status_t modsecurity_request_body_clear(modsec_rec *msr, char **error_msg) {
891891
892892if (msr -> msc_reqbody_filename != NULL ) {
893893if (keep_body ) {
894+ /* Move request body (which is a file) to the storage area. */
895+ const char * put_filename = NULL ;
896+ const char * put_basename = NULL ;
897+
894898if (strcmp (msr -> txcfg -> upload_dir ,msr -> txcfg -> tmp_dir )== 0 ) {
895899msr_log (msr ,4 ,"Not moving file to identical location." );
896900 gotonullify ;
897901 }
898902
899- /* Move request body (which is a file) to the storage area. */
900- const char * put_filename = NULL ;
901- const char * put_basename = NULL ;
902-
903903/* Construct the new filename. */
904904put_basename = file_basename (msr -> msc_reqbody_mp ,msr -> msc_reqbody_filename );
905905if (put_basename == NULL ) {