Skip to content

Commit 7d7299e

Browse files
committed
Do not allow NULL with non-zero length.
1 parent 4550814 commit 7d7299e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

wolfcrypt/src/chacha20_poly1305.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ int wc_XChaCha20Poly1305_Init(
313313
byte authKey[CHACHA20_POLY1305_AEAD_KEYSIZE];
314314
int ret;
315315

316-
if ((aead == NULL) || (nonce == NULL) || (key == NULL))
316+
if ((aead == NULL) || (ad == NULL && ad_len > 0) || (nonce == NULL) ||
317+
(key == NULL))
317318
return BAD_FUNC_ARG;
318319

319320
if ((key_len != CHACHA20_POLY1305_AEAD_KEYSIZE) ||

0 commit comments

Comments
 (0)