From ca0fa1e4e10439957fbd76da3f4a42b14ef273a9 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 27 Apr 2026 16:12:47 +0200 Subject: [PATCH] security: fix missing NULL check after strdup in module-raop-discover Memory Safety: Medium strdup() can return NULL on allocation failure. The return value was used without checking, which would cause a NULL pointer dereference (crash) when the name is later compared with spa_streq(). Add a NULL check and free the partially-allocated struct on failure. Co-Authored-By: Claude Opus 4.6 --- src/modules/module-raop-discover.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/module-raop-discover.c b/src/modules/module-raop-discover.c index 3675b003e..60bdfa563 100644 --- a/src/modules/module-raop-discover.c +++ b/src/modules/module-raop-discover.c @@ -147,6 +147,10 @@ static struct tunnel *tunnel_new(struct impl *impl, const char *name) return NULL; t->name = strdup(name); + if (t->name == NULL) { + free(t); + return NULL; + } spa_list_append(&impl->tunnel_list, &t->link); return t;