]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Resolve undefined behaviour in wpacket test
authorPauli <ppzgs1@gmail.com>
Mon, 27 May 2024 03:37:41 +0000 (13:37 +1000)
committerPauli <ppzgs1@gmail.com>
Tue, 4 Feb 2025 20:20:10 +0000 (07:20 +1100)
There is no necessity for rand_data to be aligned so that it can be
directly dereferenced as a uint64_t.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/24498)

test/wpackettest.c

index 8e5eb8d4cf472e288e25d64461264f6f394ac78e..bc688b96646cedbe8a01972ee13214c1620a2c39 100644 (file)
@@ -590,7 +590,7 @@ static int test_WPACKET_quic_vlint_random(void)
         if (!TEST_int_gt(RAND_bytes(rand_data, sizeof(rand_data)), 0))
             return cleanup(&pkt);
 
-        memcpy(&expected, rand_data, sizeof(uint64_t));
+        memcpy(&expected, rand_data, sizeof(expected));
 
         /*
          * Ensure that all size classes get tested with equal probability.