From: Victor Julien Date: Thu, 6 Sep 2012 08:09:14 +0000 (+0200) Subject: Check response headers in custom http logging before using them. Coverity 717436. X-Git-Tag: suricata-1.4beta1~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=886a4f2850f18ba1cc68ae1b98722b92538009d9;p=thirdparty%2Fsuricata.git Check response headers in custom http logging before using them. Coverity 717436. --- 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, "(");