From c09d6e57dc6b14192ce37a2bd8e75d6a59fea063 Mon Sep 17 00:00:00 2001 From: brenosilva Date: Thu, 16 Aug 2012 18:12:46 +0000 Subject: [PATCH] Fixed some dereferenced --- apache2/re_operators.c | 54 +++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/apache2/re_operators.c b/apache2/re_operators.c index 9a8164d5..01f6b545 100644 --- a/apache2/re_operators.c +++ b/apache2/re_operators.c @@ -1978,16 +1978,17 @@ static int msre_op_within_execute(modsec_rec *msr, msre_rule *rule, msre_var *va unsigned int i, i_max; str->value = (char *)rule->op_param; - str->value_len = strlen(str->value); - - if (error_msg == NULL) return -1; - *error_msg = NULL; if (str->value == NULL) { *error_msg = "Internal Error: match string is null."; return -1; } + str->value_len = strlen(str->value); + + if (error_msg == NULL) return -1; + *error_msg = NULL; + expand_macros(msr, str, rule, msr->mp); match = (const char *)str->value; @@ -2047,16 +2048,17 @@ static int msre_op_contains_execute(modsec_rec *msr, msre_rule *rule, msre_var * unsigned int i, i_max; str->value = (char *)rule->op_param; - str->value_len = strlen(str->value); - - if (error_msg == NULL) return -1; - *error_msg = NULL; if (str->value == NULL) { *error_msg = "Internal Error: match string is null."; return -1; } + str->value_len = strlen(str->value); + + if (error_msg == NULL) return -1; + *error_msg = NULL; + expand_macros(msr, str, rule, msr->mp); match = (const char *)str->value; @@ -2123,16 +2125,17 @@ static int msre_op_containsWord_execute(modsec_rec *msr, msre_rule *rule, msre_v int rc = 0; str->value = (char *)rule->op_param; - str->value_len = strlen(str->value); - - if (error_msg == NULL) return -1; - *error_msg = NULL; if (str->value == NULL) { *error_msg = "Internal Error: match string is null."; return -1; } + str->value_len = strlen(str->value); + + if (error_msg == NULL) return -1; + *error_msg = NULL; + expand_macros(msr, str, rule, msr->mp); match = (const char *)str->value; @@ -2215,16 +2218,17 @@ static int msre_op_streq_execute(modsec_rec *msr, msre_rule *rule, msre_var *var unsigned int target_length; str->value = (char *)rule->op_param; - str->value_len = strlen(str->value); - - if (error_msg == NULL) return -1; - *error_msg = NULL; if (str->value == NULL) { *error_msg = "Internal Error: match string is null."; return -1; } + str->value_len = strlen(str->value); + + if (error_msg == NULL) return -1; + *error_msg = NULL; + expand_macros(msr, str, rule, msr->mp); match = (const char *)str->value; @@ -2270,16 +2274,17 @@ static int msre_op_beginsWith_execute(modsec_rec *msr, msre_rule *rule, msre_var unsigned int target_length; str->value = (char *)rule->op_param; - str->value_len = strlen(str->value); - - if (error_msg == NULL) return -1; - *error_msg = NULL; if (str->value == NULL) { *error_msg = "Internal Error: match string is null."; return -1; } + str->value_len = strlen(str->value); + + if (error_msg == NULL) return -1; + *error_msg = NULL; + expand_macros(msr, str, rule, msr->mp); match = (const char *)str->value; @@ -2332,16 +2337,17 @@ static int msre_op_endsWith_execute(modsec_rec *msr, msre_rule *rule, msre_var * unsigned int target_length; str->value = (char *)rule->op_param; - str->value_len = strlen(str->value); - - if (error_msg == NULL) return -1; - *error_msg = NULL; if (str->value == NULL) { *error_msg = "Internal Error: match string is null."; return -1; } + str->value_len = strlen(str->value); + + if (error_msg == NULL) return -1; + *error_msg = NULL; + expand_macros(msr, str, rule, msr->mp); match = (const char *)str->value;