From 591330ab74d8017515d0d01ded5a3adeaacb385e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 3 Jan 2024 14:04:13 +0100 Subject: [PATCH] protocol: don't allow NULL event or command If causes crashes when the handlers try to get the ID. --- src/modules/module-client-node/protocol-native.c | 9 +++++++++ src/modules/module-protocol-native/protocol-native.c | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/modules/module-client-node/protocol-native.c b/src/modules/module-client-node/protocol-native.c index 33db631fb..3051703af 100644 --- a/src/modules/module-client-node/protocol-native.c +++ b/src/modules/module-client-node/protocol-native.c @@ -412,6 +412,9 @@ static int client_node_demarshal_event_event(void *data, const struct pw_protoco SPA_POD_PodObject(&event)) < 0) return -EINVAL; + if (event == NULL) + return -EINVAL; + pw_proxy_notify(proxy, struct pw_client_node_events, event, 0, event); return 0; } @@ -427,6 +430,9 @@ static int client_node_demarshal_command(void *data, const struct pw_protocol_na SPA_POD_PodObject(&command)) < 0) return -EINVAL; + if (command == NULL) + return -EINVAL; + pw_proxy_notify(proxy, struct pw_client_node_events, command, 0, command); return 0; } @@ -1097,6 +1103,9 @@ static int client_node_demarshal_event_method(void *object, const struct pw_prot SPA_POD_PodObject(&event)) < 0) return -EINVAL; + if (event == NULL) + return -EINVAL; + pw_resource_notify(resource, struct pw_client_node_methods, event, 0, event); return 0; } diff --git a/src/modules/module-protocol-native/protocol-native.c b/src/modules/module-protocol-native/protocol-native.c index 45f5f45a3..1681514eb 100644 --- a/src/modules/module-protocol-native/protocol-native.c +++ b/src/modules/module-protocol-native/protocol-native.c @@ -1342,6 +1342,9 @@ static int node_demarshal_send_command(void *object, const struct pw_protocol_na SPA_POD_Pod(&command)) < 0) return -EINVAL; + if (command == NULL) + return -EINVAL; + return pw_resource_notify(resource, struct pw_node_methods, send_command, 0, command); }