From 0cc3644e55c7ea1642fe51d2a6d05735144b5e67 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 13 Apr 2026 10:26:33 +0200 Subject: [PATCH] dlopen: support search path ending in / When the search path is /usr/lib/, /usr/lib/foo.so fails to load because there is no / after the search path. Fix this by requiring that either the search path end with / or the following char is a /. --- spa/plugins/filter-graph/plugin_ladspa.c | 2 +- src/modules/module-jack-tunnel/weakjack.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spa/plugins/filter-graph/plugin_ladspa.c b/spa/plugins/filter-graph/plugin_ladspa.c index 6335d002f..54315861b 100644 --- a/spa/plugins/filter-graph/plugin_ladspa.c +++ b/spa/plugins/filter-graph/plugin_ladspa.c @@ -265,7 +265,7 @@ static int load_ladspa_plugin(struct plugin *impl, const char *path, const char if (len == 0 || len >= sizeof(filename)) continue; - if (strncmp(path, p, len) == 0 && path[len] == '/') + if (strncmp(path, p, len) == 0 && (path[len-1] == '/' || path[len] == '/')) namelen = snprintf(filename, sizeof(filename), "%s", path); else namelen = snprintf(filename, sizeof(filename), "%.*s/%s.so", (int) len, p, path); diff --git a/src/modules/module-jack-tunnel/weakjack.h b/src/modules/module-jack-tunnel/weakjack.h index 472adb253..6a3d9bc67 100644 --- a/src/modules/module-jack-tunnel/weakjack.h +++ b/src/modules/module-jack-tunnel/weakjack.h @@ -178,7 +178,7 @@ static inline int weakjack_load(struct weakjack *jack, const char *lib) if (len == 0 || len >= sizeof(path)) continue; - if (strncmp(lib, p, len) == 0 && lib[len] == '/') + if (strncmp(lib, p, len) == 0 && (lib[len-1] == '/' || lib[len] == '/')) pathlen = snprintf(path, sizeof(path), "%s", lib); else pathlen = snprintf(path, sizeof(path), "%.*s/%s", (int) len, p, lib);