Do not allow NULL with non-zero length.

This commit is contained in:
Anthony Hu
2026-01-21 17:49:30 -05:00
parent 4550814e66
commit 7d7299e254

View File

@@ -313,7 +313,8 @@ int wc_XChaCha20Poly1305_Init(
byte authKey[CHACHA20_POLY1305_AEAD_KEYSIZE];
int ret;
if ((aead == NULL) || (nonce == NULL) || (key == NULL))
if ((aead == NULL) || (ad == NULL && ad_len > 0) || (nonce == NULL) ||
(key == NULL))
return BAD_FUNC_ARG;
if ((key_len != CHACHA20_POLY1305_AEAD_KEYSIZE) ||