From: Martti Rannanjärvi Date: Wed, 6 Apr 2022 17:13:24 +0000 (+0300) Subject: lib-dcrypt: test-stream.c - Remove pointer arithmetic in test_read_garbage() X-Git-Tag: 2.4.0~4165 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e8868a39dc9893972245b7e2b9dd886f4e119100;p=thirdparty%2Fdovecot%2Fcore.git lib-dcrypt: test-stream.c - Remove pointer arithmetic in test_read_garbage() Something is wrong with the pointer arithmetic given to random_fill(), and easiest is to remove it altogether. This fixes a valgrind complaint on use of uninitialized value. --- diff --git a/src/lib-dcrypt/test-stream.c b/src/lib-dcrypt/test-stream.c index 8ec0a34581..74725fc256 100644 --- a/src/lib-dcrypt/test-stream.c +++ b/src/lib-dcrypt/test-stream.c @@ -595,9 +595,9 @@ static void test_read_garbage(void) test_begin("test_read_garbage"); unsigned char buf[512]; for (int i = 0; i < 5; i++) { + random_fill(buf, sizeof(buf)); memcpy(buf, IOSTREAM_CRYPT_MAGIC, sizeof(IOSTREAM_CRYPT_MAGIC)); buf[sizeof(IOSTREAM_CRYPT_MAGIC)+1] = '\x02'; - random_fill(buf + 10, sizeof(buf) - 10); struct istream *is = test_istream_create_data(buf, sizeof(buf)); struct istream *ds = i_stream_create_decrypt_callback(is, no_op_cb, NULL);