connection: reject too large messages

Instead of silently truncating the message size in the header, simply
reject the complete message.
This commit is contained in:
Wim Taymans 2026-05-01 13:04:02 +02:00
parent 08f7fef820
commit 3eb7315bda

View file

@ -702,11 +702,14 @@ pw_protocol_native_connection_end(struct pw_protocol_native_connection *conn,
struct buffer *buf = &impl->out;
int res;
if (size > 0xffffff)
return -ENOSPC;
if ((p = connection_ensure_size(conn, buf, impl->hdr_size + size)) == NULL)
return -errno;
p[0] = buf->msg.id;
p[1] = (buf->msg.opcode << 24) | (size & 0xffffff);
p[1] = (buf->msg.opcode << 24) | size;
if (impl->version >= 3) {
p[2] = buf->msg.seq;
p[3] = buf->msg.n_fds;