mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-02-24 01:40:35 -05:00
Reject messages not multiple of 4 bytes
At least libwayland and ocaml-wayland will never produce such messages, and it is at best ambiguous whether they are allowed by the specification. There are also implementations of the Wayland protocol that reject such messages, so using them has never been portable. Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
This commit is contained in:
parent
5b692b50b9
commit
87e2b7d6c2
3 changed files with 20 additions and 3 deletions
|
|
@ -902,7 +902,14 @@ wl_connection_demarshal(struct wl_connection *connection,
|
|||
|
||||
/* Space for sender_id and opcode */
|
||||
if (size < 2 * sizeof *p) {
|
||||
wl_log("message too short, invalid header\n");
|
||||
wl_log("message length %" PRIu32 " too short, invalid header\n", size);
|
||||
wl_connection_consume(connection, size);
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (size % sizeof *p) {
|
||||
wl_log("message length %" PRIu32 " invalid, not multiple of 4 bytes", size);
|
||||
wl_connection_consume(connection, size);
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue