From 3ea22ffa32f3a3c9649018dc331f257499ed4214 Mon Sep 17 00:00:00 2001 From: David Garske Date: Tue, 27 Jul 2021 12:07:08 -0700 Subject: [PATCH] Remove use of assert (replace with soft failures). Note: Session hash will always return value < HASH_SIZE. --- src/sniffer.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/sniffer.c b/src/sniffer.c index 6b7bad300..88eca92a8 100644 --- a/src/sniffer.c +++ b/src/sniffer.c @@ -66,7 +66,6 @@ #if !defined(WOLFCRYPT_ONLY) && !defined(NO_FILESYSTEM) #ifdef WOLFSSL_SNIFFER -#include #include #ifdef FUSION_RTOS @@ -1433,8 +1432,6 @@ static SnifferSession* GetSnifferSession(IpInfo* ipInfo, TcpInfo* tcpInfo) time_t currTime = XTIME(NULL); word32 row = SessionHash(ipInfo, tcpInfo); - assert(row <= HASH_SIZE); - wc_LockMutex(&SessionMutex); session = SessionTable[row]; @@ -4121,13 +4118,15 @@ static void RemoveSession(SnifferSession* session, IpInfo* ipInfo, word32 row = rowHint; int haveLock = 0; + Trace(REMOVE_SESSION_STR); + if (ipInfo && tcpInfo) row = SessionHash(ipInfo, tcpInfo); else haveLock = 1; - assert(row <= HASH_SIZE); - Trace(REMOVE_SESSION_STR); + if (row >= HASH_SIZE) + return; if (!haveLock) wc_LockMutex(&SessionMutex);