Reject messages with trailing junk

These will never be sent by libwayland and likely indicate that a peer
is using a wrong protocol specification.  Furthermore, there are other
implementations that also reject such messages, so using them is not
portable.

Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
This commit is contained in:
Demi Marie Obenour 2024-07-24 21:21:21 -04:00
parent 87e2b7d6c2
commit 0134cf4cde
2 changed files with 8 additions and 0 deletions

View file

@ -1069,6 +1069,12 @@ wl_connection_demarshal(struct wl_connection *connection,
}
}
if (p != end) {
wl_log("trailing junk\n");
errno = EINVAL;
goto err;
}
wl_connection_consume(connection, size);
return closure;