mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Merge pull request #2954 from marcstern/v2/mst/optim2
remove useless memset
This commit is contained in:
@@ -630,18 +630,13 @@ nextround:
|
||||
}
|
||||
|
||||
if(msr->stream_input_data != NULL && input_body == 1) {
|
||||
memset(msr->stream_input_data, 0x0, msr->stream_input_length);
|
||||
free(msr->stream_input_data);
|
||||
msr->stream_input_data = NULL;
|
||||
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;
|
||||
}
|
||||
@@ -649,16 +644,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;
|
||||
@@ -761,7 +751,6 @@ static int msre_op_validateHash_execute(modsec_rec *msr, msre_rule *rule, msre_v
|
||||
char *my_error_msg = NULL;
|
||||
int ovector[33];
|
||||
int rc;
|
||||
const char *pattern = NULL;
|
||||
#ifdef WITH_PCRE_STUDY
|
||||
#ifdef WITH_PCRE_JIT
|
||||
int jit = 0;
|
||||
@@ -791,8 +780,8 @@ static int msre_op_validateHash_execute(modsec_rec *msr, msre_rule *rule, msre_v
|
||||
|
||||
expand_macros(msr, re_pattern, rule, msr->mp);
|
||||
|
||||
pattern = log_escape_re(msr->mp, re_pattern->value);
|
||||
if (msr->txcfg->debuglog_level >= 6) {
|
||||
const char *pattern = log_escape_re(msr->mp, re_pattern->value);
|
||||
msr_log(msr, 6, "Escaping pattern [%s]",pattern);
|
||||
}
|
||||
|
||||
@@ -1545,10 +1534,10 @@ static const char *gsb_replace_tpath(apr_pool_t *pool, const char *domain, int l
|
||||
url = apr_palloc(pool, len + 1);
|
||||
data = apr_palloc(pool, len + 1);
|
||||
|
||||
memset(data, 0, len+1);
|
||||
memset(url, 0, len+1);
|
||||
|
||||
data[0] = '\0';
|
||||
|
||||
memcpy(url, domain, len);
|
||||
url[len] = 0;
|
||||
|
||||
while(( pos = strstr(url , "/./" )) != NULL) {
|
||||
match = 1;
|
||||
|
Reference in New Issue
Block a user