Fix the order of error_msg validation

Reported by @marcstern at #2128
This commit is contained in:
Felipe Zimmerle
2019-07-10 14:41:32 -03:00
parent 28b4be670f
commit 176276a931
2 changed files with 5 additions and 3 deletions

View File

@@ -1993,6 +1993,9 @@ static int msre_op_within_execute(modsec_rec *msr, msre_rule *rule, msre_var *va
unsigned int target_length = 0;
unsigned int i, i_max;
if (error_msg == NULL) return -1;
*error_msg = NULL;
str->value = (char *)rule->op_param;
if (str->value == NULL) {
@@ -2002,9 +2005,6 @@ static int msre_op_within_execute(modsec_rec *msr, msre_rule *rule, msre_var *va
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;