wolfcrypt/src/evp.c: fix wolfSSL_EVP_CIPHER_CTX_ctrl() null pointer passed to XMEMCPY(), found by sanitizers under gcc-11.2.1.

pull/4706/head
Daniel Pouzzner 2021-12-27 17:59:28 -06:00
parent 930cc053d5
commit aa05eb2879
1 changed files with 2 additions and 1 deletions

View File

@ -4817,7 +4817,8 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
/* OpenSSL increments the IV. Not sure why */
IncCtr(ctx->iv, ctx->ivSz);
/* Clear any leftover AAD. */
XMEMSET(ctx->gcmAuthIn, 0, ctx->gcmAuthInSz);
if (ctx->gcmAuthIn != NULL)
XMEMSET(ctx->gcmAuthIn, 0, ctx->gcmAuthInSz);
ctx->gcmAuthInSz = 0;
ret = WOLFSSL_SUCCESS;
break;