diff --git a/src/crypto.c b/src/crypto.c index 475ebf36..cd50d6f7 100644 --- a/src/crypto.c +++ b/src/crypto.c @@ -389,7 +389,9 @@ bool aes_siv_decrypt(const void *key, size_t key_len, const void *in, if (in_len < 16) return false; - memcpy(iov, ad, sizeof(struct iovec) * num_ad); + if (ad) + memcpy(iov, ad, sizeof(struct iovec) * num_ad); + iov[num_ad].iov_base = (void *)out; iov[num_ad].iov_len = in_len - 16; num_ad++;