From ccc9612e823601f9bb7675bf2b029fd6eed6ed7b Mon Sep 17 00:00:00 2001 From: Fergus Dall Date: Tue, 22 Jun 2021 19:31:26 +1000 Subject: connection: Handle non-nullable strings in wl_connection_demarshal Currently a null string passed into a non-nullable argument of a message will decode succesfully, probably resulting in the handler function crashing. Instead treat it the same way we do non-nullable objects and ids. Signed-off-by: Fergus Dall --- src/connection.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/connection.c b/src/connection.c index 69190a1..ccbb972 100644 --- a/src/connection.c +++ b/src/connection.c @@ -749,6 +749,13 @@ wl_connection_demarshal(struct wl_connection *connection, case 's': length = *p++; + if (length == 0 && !arg.nullable) { + wl_log("NULL string received on non-nullable " + "type, message %s(%s)\n", message->name, + message->signature); + errno = EINVAL; + goto err; + } if (length == 0) { closure->args[i].s = NULL; break; -- cgit v1.2.3-70-g09d2