diff options
| author | Fergus Dall <sidereal@google.com> | 2021-07-10 00:09:59 +1000 |
|---|---|---|
| committer | Daniel Stone <daniels@collabora.com> | 2021-07-22 22:27:45 +0000 |
| commit | e5c3ac9bcd84df0f6bfd8fa1a1f549cab34eb439 (patch) | |
| tree | e64bdd3a993eace39b0ec6dc72381a0ce1c55b64 /tests | |
| parent | server: Fix undefined behavior in wl_socket_init_for_display_name (diff) | |
| download | wayland-e5c3ac9bcd84df0f6bfd8fa1a1f549cab34eb439.tar wayland-e5c3ac9bcd84df0f6bfd8fa1a1f549cab34eb439.tar.gz wayland-e5c3ac9bcd84df0f6bfd8fa1a1f549cab34eb439.tar.bz2 wayland-e5c3ac9bcd84df0f6bfd8fa1a1f549cab34eb439.tar.lz wayland-e5c3ac9bcd84df0f6bfd8fa1a1f549cab34eb439.tar.xz wayland-e5c3ac9bcd84df0f6bfd8fa1a1f549cab34eb439.tar.zst wayland-e5c3ac9bcd84df0f6bfd8fa1a1f549cab34eb439.zip | |
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>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/connection-test.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/connection-test.c b/tests/connection-test.c index 7220d87..eea9287 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); |
