Skip to content

Commit 9c9761a

Browse files
committed
Handle possible NULL value in capture setting fn
1 parent c519ab4 commit 9c9761a

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

apache2/msc_util.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,9 +589,14 @@ int set_match_to_tx_safe(modsec_rec *msr, int capture, const char *match, unsign
589589

590590
s->name = apr_psprintf(msr->mp,"%d", tx_n);
591591
s->name_len = strlen(s->name);
592-
s->value = apr_pstrmemdup(msr->mp, match, match_len);
593-
if (s->value == NULL) return -1;
594-
s->value_len = match_len;
592+
if (match) {
593+
s->value = apr_pstrmemdup(msr->mp, match, match_len);
594+
if (s->value == NULL) return -1;
595+
s->value_len = match_len;
596+
}
597+
else {
598+
return -1;
599+
}
595600
apr_table_setn(msr->tx_vars, s->name, (void *)s);
596601

597602
if (msr->txcfg->debuglog_level >= 9) {

0 commit comments

Comments
 (0)