From: Philippe Antoine Date: Thu, 10 Mar 2022 14:26:48 +0000 (+0100) Subject: log: prevents use of uninitialized variable X-Git-Tag: suricata-7.0.0-beta1~804 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4640b15d8cc57487d61bb922049aa60f4137e904;p=thirdparty%2Fsuricata.git log: prevents use of uninitialized variable Even if the code seems unreachable for now --- diff --git a/src/alert-debuglog.c b/src/alert-debuglog.c index e2d1fb85dd..8a20a8b5ac 100644 --- a/src/alert-debuglog.c +++ b/src/alert-debuglog.c @@ -42,6 +42,7 @@ #include "util-unittest.h" #include "util-debug.h" +#include "util-validate.h" #include "util-buffer.h" #include "output.h" @@ -175,7 +176,8 @@ static TmEcode AlertDebugLogger(ThreadVars *tv, const Packet *p, void *thread_da if (PKT_IS_IPV4(p)) { PrintInet(AF_INET, (const void *)GET_IPV4_SRC_ADDR_PTR(p), srcip, sizeof(srcip)); PrintInet(AF_INET, (const void *)GET_IPV4_DST_ADDR_PTR(p), dstip, sizeof(dstip)); - } else if (PKT_IS_IPV6(p)) { + } else { + DEBUG_VALIDATE_BUG_ON(!(PKT_IS_IPV6(p))); PrintInet(AF_INET6, (const void *)GET_IPV6_SRC_ADDR(p), srcip, sizeof(srcip)); PrintInet(AF_INET6, (const void *)GET_IPV6_DST_ADDR(p), dstip, sizeof(dstip)); }