mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-02-23 01:40:43 -05:00
Merge branch 'strict-message-size' into 'main'
Require messages to use as few bytes as possible See merge request wayland/wayland!416
This commit is contained in:
commit
6ba271fd4a
3 changed files with 28 additions and 3 deletions
|
|
@ -904,7 +904,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;
|
||||
|
|
@ -1072,6 +1079,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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue