From 3cbaea8bc6a477e7a87c3067c0eb1858a3cb3eb8 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 12 Dec 2022 00:16:51 +0100 Subject: [PATCH] Avoid memcmp() with len=0 --- test/default/aead_aes256gcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/default/aead_aes256gcm.c b/test/default/aead_aes256gcm.c index ce9b4729..8165d531 100644 --- a/test/default/aead_aes256gcm.c +++ b/test/default/aead_aes256gcm.c @@ -3283,7 +3283,7 @@ tv2(void) NULL, 0, nonce, key) != 0) { printf("Decryption of random ciphertext failed"); } - assert(memcmp(message, message2, message_len) == 0); + assert(message_len == 0 || memcmp(message, message2, message_len) == 0); sodium_free(key); sodium_free(nonce); sodium_free(ciphertext);