connection: Error out if file descriptor was not received

Otherwise the tail of fds_in buffer would just shift beyond the beginning.
That confuses the actual request handler and results in a crash further on
due to corrupted tail.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
This commit is contained in:
Lubomir Rintel 2013-11-16 14:31:03 +01:00 committed by Kristian Høgsberg
parent 40d057f2c9
commit 360dca517a

View file

@ -744,6 +744,15 @@ wl_connection_demarshal(struct wl_connection *connection,
p = next;
break;
case 'h':
if (connection->fds_in.tail == connection->fds_in.head) {
printf("file descriptor expected, "
"object (%d), message %s(%s)\n",
closure->sender_id, message->name,
message->signature);
errno = EINVAL;
goto err;
}
wl_buffer_copy(&connection->fds_in, &fd, sizeof fd);
connection->fds_in.tail += sizeof fd;
closure->args[i].h = fd;