1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-23 20:15:19 -07:00

Avoid memcmp() with len=0

This commit is contained in:
Frank Denis 2022-12-12 00:16:51 +01:00
parent fbad6b933b
commit 3cbaea8bc6

View File

@ -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);