Skip to content

Commit 18efc80

Browse files
author
Marc Stern
committed
Double memory allocation:
'current_targets' is allocated in ruleset->mp. 'rule->p1' is a copy of current_targets, but we strdup it in the same memory pool as 'current_targets'. So, simply assign 'current_targets' to 'rule->p1'.
1 parent 2105ed0 commit 18efc80

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apache2/re.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ char *update_rule_target_ex(modsec_rec *msr, msre_ruleset *ruleset, msre_rule *r
499499
if(var_appended == 1) {
500500
current_targets = msre_generate_target_string(ruleset->mp, rule);
501501
rule->unparsed = msre_rule_generate_unparsed(ruleset->mp, rule, current_targets, NULL, NULL);
502-
rule->p1 = apr_pstrdup(ruleset->mp, current_targets);
502+
rule->p1 = current_targets;
503503
if(msr) {
504504
msr_log(msr, 9, "Successfully appended variable");
505505
}

0 commit comments

Comments
 (0)