summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorReinhard Urban <reinhard.urban@nubix.de>2022-10-28 09:56:05 +0200
committerTomas Mraz <tomas@openssl.org>2022-11-07 19:22:43 +0100
commitb699a1e89d2b44115a59635cfe27fb1a7f5d220f (patch)
tree41bcbe58218409d61010e775daa1c6ef20b916f3 /test
parentbae1d405cf08854eb354354c7ea7ff8f5a4865eb (diff)
Fix PACKET_equal test with BUF_LEN+1 on -Wstringop-overread
Either suppress the error, or better make smbuf longer. Detected with -Werror. CLA: trivial Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19528) (cherry picked from commit 91b7520e2385a513ad879dfa8fe8e45466315a27)
Diffstat (limited to 'test')
-rw-r--r--test/packettest.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/packettest.c b/test/packettest.c
index b82b9fb502..17831d940b 100644
--- a/test/packettest.c
+++ b/test/packettest.c
@@ -12,13 +12,13 @@
#define BUF_LEN 255
-static unsigned char smbuf[BUF_LEN];
+static unsigned char smbuf[BUF_LEN + 1];
static int test_PACKET_remaining(void)
{
PACKET pkt;
- if (!TEST_true(PACKET_buf_init(&pkt, smbuf, sizeof(smbuf)))
+ if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN))
|| !TEST_size_t_eq(PACKET_remaining(&pkt), BUF_LEN)
|| !TEST_true(PACKET_forward(&pkt, BUF_LEN - 1))
|| !TEST_size_t_eq(PACKET_remaining(&pkt), 1)
@@ -33,7 +33,7 @@ static int test_PACKET_end(void)
{
PACKET pkt;
- if (!TEST_true(PACKET_buf_init(&pkt, smbuf, sizeof(smbuf)))
+ if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN))
|| !TEST_size_t_eq(PACKET_remaining(&pkt), BUF_LEN)
|| !TEST_ptr_eq(PACKET_end(&pkt), smbuf + BUF_LEN)
|| !TEST_true(PACKET_forward(&pkt, BUF_LEN - 1))