aboutsummaryrefslogtreecommitdiffstats
path: root/src/connection.c
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2016-02-10 23:35:44 +0800
committerBryce Harrington <bryce@osg.samsung.com>2016-02-11 13:48:23 -0800
commitbf34ac75d0d61609296de1300196c843f4246e7c (patch)
treebce2b6db87c37bb5a25c8508219551da0d4b6109 /src/connection.c
parentconfigure.ac: bump to version 1.9.93 for the RC1 release (diff)
downloadwayland-bf34ac75d0d61609296de1300196c843f4246e7c.tar
wayland-bf34ac75d0d61609296de1300196c843f4246e7c.tar.gz
wayland-bf34ac75d0d61609296de1300196c843f4246e7c.tar.bz2
wayland-bf34ac75d0d61609296de1300196c843f4246e7c.tar.lz
wayland-bf34ac75d0d61609296de1300196c843f4246e7c.tar.xz
wayland-bf34ac75d0d61609296de1300196c843f4246e7c.tar.zst
wayland-bf34ac75d0d61609296de1300196c843f4246e7c.zip
connection: Don't add uninitialized memory as 4 byte alignment padding
When we are adding padding bytes making our wl_buffer buffer content 4 byte aligned, we are just moving the pointer. Since the buffer is allocated using plain malloc(), this means our padding bytes are effectively uninitialized data, which could be anything previously allocated in the server process. As we'll be sharing this buffer content with arbitrary clients, we are effectively sharing private memory with every client, and even though a well behaving client will discard any such memory, a malicious client may not. Therefor, to avoid any potential missuse of the uninitialized padding memory shared between the server and client, initialize the buffer content to 0, making the padding bytes always 0. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Diffstat (limited to 'src/connection.c')
-rw-r--r--src/connection.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/connection.c b/src/connection.c
index 65b64e9..c0e322f 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1137,7 +1137,7 @@ wl_closure_send(struct wl_closure *closure, struct wl_connection *connection)
return -1;
buffer_size = buffer_size_for_closure(closure);
- buffer = malloc(buffer_size * sizeof buffer[0]);
+ buffer = zalloc(buffer_size * sizeof buffer[0]);
if (buffer == NULL)
return -1;