]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Check response headers in custom http logging before using them. Coverity 717436.
authorVictor Julien <victor@inliniac.net>
Thu, 6 Sep 2012 08:09:14 +0000 (10:09 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 6 Sep 2012 08:18:58 +0000 (10:18 +0200)
src/log-httplog.c

index a8bd96c436528c20ecf8b058fd9e86b802eba0a0..941a6ff79fe9881fcb72fb80b373a9515c2873ea 100644 (file)
@@ -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, "(");