mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 13:56:01 +03:00
Merge pull request #3153 from marcstern/v2/LARGE_STREAM_INPUT_nullend
Missing null byte + optimization
This commit is contained in:
commit
8a3b62021e
@ -649,12 +649,8 @@ nextround:
|
|||||||
msr->stream_input_length = 0;
|
msr->stream_input_length = 0;
|
||||||
#ifdef MSC_LARGE_STREAM_INPUT
|
#ifdef MSC_LARGE_STREAM_INPUT
|
||||||
msr->stream_input_allocated_length = 0;
|
msr->stream_input_allocated_length = 0;
|
||||||
|
|
||||||
msr->stream_input_data = (char *)malloc(size);
|
|
||||||
#else
|
|
||||||
msr->stream_input_data = (char *)malloc(size+1);
|
|
||||||
#endif
|
#endif
|
||||||
|
msr->stream_input_data = (char *)malloc(size+1);
|
||||||
if(msr->stream_input_data == NULL) {
|
if(msr->stream_input_data == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -662,16 +658,11 @@ nextround:
|
|||||||
msr->stream_input_length = size;
|
msr->stream_input_length = size;
|
||||||
#ifdef MSC_LARGE_STREAM_INPUT
|
#ifdef MSC_LARGE_STREAM_INPUT
|
||||||
msr->stream_input_allocated_length = size;
|
msr->stream_input_allocated_length = size;
|
||||||
memset(msr->stream_input_data, 0x0, size);
|
|
||||||
#else
|
|
||||||
memset(msr->stream_input_data, 0x0, size+1);
|
|
||||||
#endif
|
#endif
|
||||||
msr->if_stream_changed = 1;
|
msr->if_stream_changed = 1;
|
||||||
|
|
||||||
memcpy(msr->stream_input_data, data, size);
|
memcpy(msr->stream_input_data, data, size);
|
||||||
#ifndef MSC_LARGE_STREAM_INPUT
|
|
||||||
msr->stream_input_data[size] = '\0';
|
msr->stream_input_data[size] = '\0';
|
||||||
#endif
|
|
||||||
|
|
||||||
var->value_len = size;
|
var->value_len = size;
|
||||||
var->value = msr->stream_input_data;
|
var->value = msr->stream_input_data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user