Skip to content

Commit 966e7e1

Browse files
author
Felipe Zimmerle
committed
Adds verification before access the strcmp
Audit log was making the assumption that "arg->origin" was filled which is not necessary true. This commit adds an verification.
1 parent c5c2690 commit 966e7e1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

apache2/msc_logging.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static int sec_auditlog_write(modsec_rec *msr, const char *data, unsigned int le
5353

5454
msr_log(msr, 1, "Audit log: Failed writing (requested %" APR_SIZE_T_FMT
5555
" bytes, written %" APR_SIZE_T_FMT "): %s", nbytes, nbytes_written,
56-
apr_strerror(rc, errstr, sizeof(errstr));
56+
apr_strerror(rc, errstr, sizeof(errstr)));
5757

5858
/* Concurrent log format: don't leak file handle. */
5959
if (msr->txcfg->auditlog_type == AUDITLOG_CONCURRENT) {
@@ -704,7 +704,9 @@ void sec_audit_logger(modsec_rec *msr) {
704704
telts = (const apr_table_entry_t*)tarr->elts;
705705
for(i = 0; i < tarr->nelts; i++) {
706706
msc_arg *arg = (msc_arg *)telts[i].val;
707-
if (strcmp(arg->origin, "BODY") != 0) continue;
707+
if (arg->origin != NULL &&
708+
strcmp(arg->origin, "BODY") != 0)
709+
continue;
708710

709711
if (last_offset == 0) { /* The first time we're here. */
710712
if (arg->value_origin_offset > offset) {

0 commit comments

Comments
 (0)