From 886a4f2850f18ba1cc68ae1b98722b92538009d9 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 6 Sep 2012 10:09:14 +0200 Subject: [PATCH] Check response headers in custom http logging before using them. Coverity 717436. --- src/log-httplog.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/log-httplog.c b/src/log-httplog.c index a8bd96c436..941a6ff79f 100644 --- a/src/log-httplog.c +++ b/src/log-httplog.c @@ -273,7 +273,10 @@ static void LogHttpLogCustom(LogHttpLogThread *aft, htp_tx_t *tx, const struct t aft->buffer->size, (uint8_t *)bstr_ptr(tx->response_status), bstr_len(tx->response_status)); /* Redirect? */ - if ((tx->response_status_number > 300) && ((tx->response_status_number) < 303)){ + if (tx->response_headers != NULL && + tx->response_status_number > 300 && + tx->response_status_number < 303) + { htp_header_t *h_location = table_getc(tx->response_headers, "location"); if (h_location != NULL) { MemBufferWriteString(aft->buffer, "(");