]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dcrypt: test-stream - Ensure file is v2 in test_read_garbage
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 4 Apr 2022 16:12:47 +0000 (19:12 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 5 Apr 2022 11:24:10 +0000 (11:24 +0000)
src/lib-dcrypt/test-stream.c

index b067e61c324dbb6658e8b3f4f993b4312c28f33d..8ec0a34581b89601fd360dd7ac22c7c6bfffd0bd 100644 (file)
@@ -596,7 +596,8 @@ static void test_read_garbage(void)
        unsigned char buf[512];
        for (int i = 0; i < 5; i++) {
                memcpy(buf, IOSTREAM_CRYPT_MAGIC, sizeof(IOSTREAM_CRYPT_MAGIC));
-               random_fill(buf + 9, sizeof(buf) - 9);
+               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);