]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: test-message-header-decode - Avoid generating random bytes that are never...
authorStephan Bosch <stephan.bosch@open-xchange.com>
Wed, 16 Sep 2020 16:28:43 +0000 (18:28 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Wed, 7 Oct 2020 14:08:11 +0000 (14:08 +0000)
src/lib-mail/test-message-header-decode.c

index 8a5fd5e540ac1ed7a2c44d2d793f52c66fa66ade..7971d1066eba9a7be1f7ccf24cbffa8c55096f4d 100644 (file)
@@ -73,9 +73,9 @@ static void test_message_header_decode_encode_random(void)
        for (i = 0; i < 1000; i++) {
                /* fill only with 7bit data so we don't have to worry about
                   the data being valid UTF-8 */
-               for (j = 0; j < sizeof(buf); j++)
-                       buf[j] = i_rand_limit(128);
                buflen = i_rand_limit(sizeof(buf));
+               for (j = 0; j < buflen; j++)
+                       buf[j] = i_rand_limit(128);
 
                str_truncate(encoded, 0);
                str_truncate(decoded, 0);