Remove use of assert (replace with soft failures). Note: Session hash will always return value < HASH_SIZE.

This commit is contained in:
David Garske
2021-07-27 12:07:08 -07:00
parent 3abb2b86d6
commit 3ea22ffa32

View File

@ -66,7 +66,6 @@
#if !defined(WOLFCRYPT_ONLY) && !defined(NO_FILESYSTEM)
#ifdef WOLFSSL_SNIFFER
#include <assert.h>
#include <time.h>
#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);