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 <sidereal@google.com>
This commit is contained in:
Fergus Dall 2021-07-10 00:09:59 +10:00 committed by Daniel Stone
parent f6b78b76b2
commit e5c3ac9bcd

View file

@ -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);