mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Replace a memset to 0 by a single assignment and fixing the 0 byte missing at the end when MSC_LARGE_STREAM_INPUT is not defined
This commit is contained in:
parent
e803cdd802
commit
4a992b5a16
@ -649,12 +649,8 @@ nextround:
|
||||
msr->stream_input_length = 0;
|
||||
#ifdef MSC_LARGE_STREAM_INPUT
|
||||
msr->stream_input_allocated_length = 0;
|
||||
|
||||
msr->stream_input_data = (char *)malloc(size);
|
||||
#else
|
||||
msr->stream_input_data = (char *)malloc(size+1);
|
||||
#endif
|
||||
|
||||
msr->stream_input_data = (char *)malloc(size+1);
|
||||
if(msr->stream_input_data == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -662,16 +658,11 @@ nextround:
|
||||
msr->stream_input_length = size;
|
||||
#ifdef MSC_LARGE_STREAM_INPUT
|
||||
msr->stream_input_allocated_length = size;
|
||||
memset(msr->stream_input_data, 0x0, size);
|
||||
#else
|
||||
memset(msr->stream_input_data, 0x0, size+1);
|
||||
#endif
|
||||
msr->if_stream_changed = 1;
|
||||
|
||||
memcpy(msr->stream_input_data, data, size);
|
||||
#ifndef MSC_LARGE_STREAM_INPUT
|
||||
msr->stream_input_data[size] = '\0';
|
||||
#endif
|
||||
|
||||
var->value_len = size;
|
||||
var->value = msr->stream_input_data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user