From e5c3ac9bcd84df0f6bfd8fa1a1f549cab34eb439 Mon Sep 17 00:00:00 2001 From: Fergus Dall Date: Sat, 10 Jul 2021 00:09:59 +1000 Subject: [PATCH] connection-test: Pad out strings with null bytes The connection_demarshal test writes a 10 byte string into a wayland message, but doesn't pad it out to a four byte boundary. This leads to the last 32-bit word of the message being partially uninitialized, which triggers an msan violation when the message is written to the socket. Signed-off-by: Fergus Dall --- tests/connection-test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/connection-test.c b/tests/connection-test.c index 7220d875..eea92873 100644 --- a/tests/connection-test.c +++ b/tests/connection-test.c @@ -431,6 +431,7 @@ TEST(connection_demarshal) msg[0] = 400200; msg[1] = 24 << 16; msg[2] = 10; + msg[3 + msg[2]/4] = 0; memcpy(&msg[3], data.value.s, msg[2]); demarshal(&data, "s", msg, (void *) validate_demarshal_s); @@ -438,6 +439,7 @@ TEST(connection_demarshal) msg[0] = 400200; msg[1] = 24 << 16; msg[2] = 10; + msg[3 + msg[2]/4] = 0; memcpy(&msg[3], data.value.s, msg[2]); demarshal(&data, "?s", msg, (void *) validate_demarshal_s);