diff options
author | Pauli <paul.dale@oracle.com> | 2019-03-29 18:42:37 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2019-03-29 20:52:01 +1000 |
commit | 72962d025f875ac35114ac090b878ee18b246144 (patch) | |
tree | 4dd31617b30ff500a4d935d3fd2f5946583c4f9d /test/packettest.c | |
parent | 6fc1e6246f9b29334fd6dcb5b832e75cce7a2ecd (diff) | |
download | openssl-72962d025f875ac35114ac090b878ee18b246144.tar.gz |
Correctly initialise PACKET to zero in the tests to avoid possible problems
with padding bytes.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8611)
Diffstat (limited to 'test/packettest.c')
-rw-r--r-- | test/packettest.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/packettest.c b/test/packettest.c index 81e0449bc9..41d938a68a 100644 --- a/test/packettest.c +++ b/test/packettest.c @@ -350,8 +350,9 @@ static int test_PACKET_get_length_prefixed_1(void) unsigned char buf1[BUF_LEN]; const size_t len = 16; unsigned int i; - PACKET pkt, short_pkt, subpkt = {0}; + PACKET pkt, short_pkt, subpkt; + memset(&subpkt, 0, sizeof(subpkt)); buf1[0] = (unsigned char)len; for (i = 1; i < BUF_LEN; i++) buf1[i] = (i * 2) & 0xff; @@ -374,8 +375,9 @@ static int test_PACKET_get_length_prefixed_2(void) unsigned char buf1[1024]; const size_t len = 516; /* 0x0204 */ unsigned int i; - PACKET pkt, short_pkt, subpkt = {0}; + PACKET pkt, short_pkt, subpkt; + memset(&subpkt, 0, sizeof(subpkt)); for (i = 1; i <= 1024; i++) buf1[i - 1] = (i * 2) & 0xff; @@ -397,8 +399,9 @@ static int test_PACKET_get_length_prefixed_3(void) unsigned char buf1[1024]; const size_t len = 516; /* 0x000204 */ unsigned int i; - PACKET pkt, short_pkt, subpkt = {0}; + PACKET pkt, short_pkt, subpkt; + memset(&subpkt, 0, sizeof(subpkt)); for (i = 0; i < 1024; i++) buf1[i] = (i * 2) & 0xff; @@ -420,8 +423,9 @@ static int test_PACKET_as_length_prefixed_1(void) unsigned char buf1[BUF_LEN]; const size_t len = 16; unsigned int i; - PACKET pkt, exact_pkt, subpkt = {0}; + PACKET pkt, exact_pkt, subpkt; + memset(&subpkt, 0, sizeof(subpkt)); buf1[0] = (unsigned char)len; for (i = 1; i < BUF_LEN; i++) buf1[i] = (i * 2) & 0xff; @@ -443,8 +447,9 @@ static int test_PACKET_as_length_prefixed_2(void) unsigned char buf[1024]; const size_t len = 516; /* 0x0204 */ unsigned int i; - PACKET pkt, exact_pkt, subpkt = {0}; + PACKET pkt, exact_pkt, subpkt; + memset(&subpkt, 0, sizeof(subpkt)); for (i = 1; i <= 1024; i++) buf[i-1] = (i * 2) & 0xff; |