diff mbox series

[1/2] crypto: fix uninitialized variable coverity warning

Message ID 20240227211618.318442-1-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [1/2] crypto: fix uninitialized variable coverity warning | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-alpine-ci-fetch success Fetch PR
prestwoj/iwd-ci-gitlint success GitLint
prestwoj/iwd-ci-fetch success Fetch PR
prestwoj/iwd-alpine-ci-makedistcheck success Make Distcheck
prestwoj/iwd-ci-makedistcheck success Make Distcheck
prestwoj/iwd-ci-build success Build - Configure
prestwoj/iwd-alpine-ci-build success Build - Configure
prestwoj/iwd-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-ci-makecheck success Make Check
prestwoj/iwd-ci-clang success clang PASS
prestwoj/iwd-alpine-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-alpine-ci-makecheck success Make Check
prestwoj/iwd-ci-incremental_build success Incremental Build with patches
prestwoj/iwd-alpine-ci-incremental_build success Incremental Build with patches
prestwoj/iwd-ci-testrunner success test-runner PASS

Commit Message

James Prestwood Feb. 27, 2024, 9:16 p.m. UTC
Same as for aes_siv_decrypt, check num_ads before calling memcpy.
---
 src/crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Denis Kenzior Feb. 27, 2024, 10:03 p.m. UTC | #1
Hi James,

On 2/27/24 15:16, James Prestwood wrote:
> Same as for aes_siv_decrypt, check num_ads before calling memcpy.
> ---
>   src/crypto.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 

Both applied, thanks.

Regards,
-Denis
diff mbox series

Patch

diff --git a/src/crypto.c b/src/crypto.c
index 7235e3c2..15a7cde7 100644
--- a/src/crypto.c
+++ b/src/crypto.c
@@ -390,7 +390,7 @@  bool aes_siv_decrypt(const void *key, size_t key_len, const void *in,
 	if (in_len < 16)
 		return false;
 
-	if (ad)
+	if (ad && num_ad)
 		memcpy(iov, ad, sizeof(struct iovec) * num_ad);
 
 	iov[num_ad].iov_base = (void *)out;