Skip to content
Commit bf34ac75 authored by Jonas Ådahl's avatar Jonas Ådahl Committed by Bryce Harrington
Browse files

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: default avatarJonas Ådahl <jadahl@gmail.com>
Reviewed-by: default avatarDerek Foreman <derekf@osg.samsung.com>
Reviewed-by: default avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: default avatarBryce Harrington <bryce@osg.samsung.com>
parent 1906a90a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment