Skip to content

Commit 6dafdb2

Browse files
committed
Revert "remove useless memset"
This reverts commit 3dc5ff5.
1 parent 8920332 commit 6dafdb2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

apache2/re_operators.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,25 +630,35 @@ static int msre_op_rsub_execute(modsec_rec *msr, msre_rule *rule, msre_var *var,
630630
}
631631

632632
if(msr->stream_input_data != NULL && input_body == 1) {
633+
memset(msr->stream_input_data, 0x0, msr->stream_input_length);
633634
free(msr->stream_input_data);
634635
msr->stream_input_data = NULL;
635636
msr->stream_input_length = 0;
636637
#ifdef MSC_LARGE_STREAM_INPUT
637638
msr->stream_input_allocated_length = 0;
638-
#endif
639+
640+
msr->stream_input_data = (char *)malloc(size);
641+
#else
639642
msr->stream_input_data = (char *)malloc(size+1);
643+
#endif
644+
640645
if(msr->stream_input_data == NULL) {
641646
return -1;
642647
}
643648

644649
msr->stream_input_length = size;
645650
#ifdef MSC_LARGE_STREAM_INPUT
646651
msr->stream_input_allocated_length = size;
652+
memset(msr->stream_input_data, 0x0, size);
653+
#else
654+
memset(msr->stream_input_data, 0x0, size+1);
647655
#endif
648656
msr->if_stream_changed = 1;
649657

650658
memcpy(msr->stream_input_data, data, size);
659+
#ifndef MSC_LARGE_STREAM_INPUT
651660
msr->stream_input_data[size] = '\0';
661+
#endif
652662

653663
var->value_len = size;
654664
var->value = msr->stream_input_data;

0 commit comments

Comments
 (0)