Skip to content

Commit 22a6829

Browse files
author
Marc Stern
committed
added more NULL checks at run-time
1 parent e5bbd89 commit 22a6829

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

apache2/re_operators.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2659,6 +2659,11 @@ static int msre_op_strmatch_param_init(msre_rule *rule, char **error_msg) {
26592659
assert(rule != NULL);
26602660
assert(rule->ruleset != NULL);
26612661
assert(error_msg != NULL);
2662+
// Normally useless code, left to be safe for the moment
2663+
if (error_msg == NULL) {
2664+
ap_log_perror(APLOG_MARK, APLOG_EMERG, 0, rule->ruleset->mp, NULL, "msre_op_strmatch_param_init: error_msg is NULL");
2665+
return -1;
2666+
}
26622667
const apr_strmatch_pattern *compiled_pattern;
26632668
char *processed = NULL;
26642669
const char *pattern = rule->op_param;
@@ -2691,6 +2696,11 @@ static int msre_op_strmatch_execute(modsec_rec *msr, msre_rule *rule, msre_var *
26912696
assert(rule != NULL);
26922697
assert(var != NULL);
26932698
assert(error_msg != NULL);
2699+
// Normally useless code, left to be safe for the moment
2700+
if (error_msg == NULL) {
2701+
ap_log_perror(APLOG_MARK, APLOG_EMERG, 0, rule->ruleset->mp, NULL, "msre_op_strmatch_execute: error_msg is NULL");
2702+
return -1;
2703+
}
26942704
apr_strmatch_pattern *compiled_pattern = (apr_strmatch_pattern *)rule->op_param_data;
26952705
const char *target;
26962706
unsigned int target_length;

0 commit comments

Comments
 (0)