@@ -84,7 +84,6 @@ static int fetch_target_exception(msre_rule *rule, modsec_rec *msr, msre_var *va
8484 assert (exceptions != NULL );
8585
8686 {
87-
8887 myvar = apr_pstrdup (msr -> mp , var -> name );
8988
9089 c = strchr (myvar ,':' );
@@ -363,11 +362,11 @@ char *update_rule_target_ex(modsec_rec *msr, msre_ruleset *ruleset, msre_rule *r
363362 rc = msre_parse_targets (ruleset , p , rule -> targets , & my_error_msg );
364363 if (rc < 0 ) {
365364 if (msr ) {
366- msr_log (msr , 9 , "Error parsing rule targets to replace variable: %s" , my_error_msg );
365+ msr_log (msr , 9 , "Error parsing rule targets to replace variable" );
367366 }
368367#if !defined(MSC_TEST )
369368 else {
370- ap_log_error (APLOG_MARK , APLOG_ERR , 0 , NULL , " ModSecurity: Error parsing rule targets to replace variable: %s" , my_error_msg );
369+ ap_log_error (APLOG_MARK , APLOG_ERR , 0 , NULL , " ModSecurity: Error parsing rule targets to replace variable" );
371370 }
372371#endif
373372 goto end ;
@@ -388,21 +387,16 @@ char *update_rule_target_ex(modsec_rec *msr, msre_ruleset *ruleset, msre_rule *r
388387 }
389388#if !defined(MSC_TEST )
390389 else {
391- ap_log_error (APLOG_MARK , APLOG_ERR , 0 , NULL , " ModSecurity: Cannot find variable to replace" );
390+ ap_log_error (APLOG_MARK , APLOG_ERR , 0 , NULL , " ModSecurity: Cannot find varibale to replace" );
392391 }
393392#endif
394393 goto end ;
395394 }
396395 } else {
397396
398397 target = strdup (p );
399- if (target == NULL ) {
400- if (target_list != NULL )
401- free (target_list );
402- if (replace != NULL )
403- free (replace );
404- return NULL ;
405- }
398+ if (target == NULL )
399+ return NULL ;
406400
407401 is_negated = is_counting = 0 ;
408402 param = name = value = NULL ;
@@ -436,8 +430,6 @@ char *update_rule_target_ex(modsec_rec *msr, msre_ruleset *ruleset, msre_rule *r
436430 free (target_list );
437431 if (replace != NULL )
438432 free (replace );
439- if (target != NULL )
440- free (target );
441433 if (msr ) {
442434 msr_log (msr , 9 , "Error to update target - [%s] is not valid target" , name );
443435 }
@@ -516,7 +508,7 @@ char *update_rule_target_ex(modsec_rec *msr, msre_ruleset *ruleset, msre_rule *r
516508 if (var_appended == 1 ) {
517509 current_targets = msre_generate_target_string (ruleset -> mp , rule );
518510 rule -> unparsed = msre_rule_generate_unparsed (ruleset -> mp , rule , current_targets , NULL , NULL );
519- rule -> p1 = current_targets ;
511+ rule -> p1 = apr_pstrdup ( ruleset -> mp , current_targets ) ;
520512 if (msr ) {
521513 msr_log (msr , 9 , "Successfully appended variable" );
522514 }
@@ -529,12 +521,18 @@ char *update_rule_target_ex(modsec_rec *msr, msre_ruleset *ruleset, msre_rule *r
529521 }
530522
531523end :
532- if (target_list != NULL )
524+ if (target_list != NULL ) {
533525 free (target_list );
534- if (replace != NULL )
526+ target_list = NULL ;
527+ }
528+ if (replace != NULL ) {
535529 free (replace );
536- if (target != NULL )
530+ replace = NULL ;
531+ }
532+ if (target != NULL ) {
537533 free (target );
534+ target = NULL ;
535+ }
538536 return NULL ;
539537}
540538
@@ -648,10 +646,7 @@ static char *msre_generate_target_string(apr_pool_t *pool, msre_rule *rule) {
648646/**
649647 * Generate an action string from an actionset.
650648 */
651- #ifndef DEBUG_CONF
652- static
653- #endif
654- char * msre_actionset_generate_action_string (apr_pool_t * pool , const msre_actionset * actionset ) {
649+ static char * msre_actionset_generate_action_string (apr_pool_t * pool , const msre_actionset * actionset ) {
655650 const apr_array_header_t * tarr = NULL ;
656651 const apr_table_entry_t * telts = NULL ;
657652 char * actions = NULL ;
@@ -1071,12 +1066,6 @@ int msre_parse_generic(apr_pool_t *mp, const char *text, apr_table_t *vartable,
10711066 /* ignore whitespace */
10721067 while (isspace (* p )) p ++ ;
10731068 if (* p == '\0' ) return count ;
1074-
1075- /* ignore empty action */
1076- if (* p == ',' ) {
1077- p ++ ;
1078- continue ;
1079- }
10801069
10811070 /* we are at the beginning of the name */
10821071 name = p ;
0 commit comments