Speculative fix for CodeSonar overflow issue

This commit is contained in:
Paul Adelsbach
2025-04-25 12:38:22 -07:00
parent b077c81eb6
commit b4d94429d1

View File

@@ -1525,7 +1525,7 @@ int CM_MemRestoreCertCache(WOLFSSL_CERT_MANAGER* cm, const void* mem, int sz)
WOLFSSL_ENTER("CM_MemRestoreCertCache");
/* Check memory available is bigger than cache header. */
if (current > end) {
if ((sz < (int)sizeof(CertCacheHeader)) || (current > end)) {
WOLFSSL_MSG("Cert Cache Memory buffer too small");
ret = BUFFER_E;
}