dlopen: improve prefix check some more

If we pass a path /usr/libevil/mycode.so, it might have a prefix of
/usr/lib but we should still reject it. Do thi by checking that after
the prefix match, we start a new directory.
This commit is contained in:
Wim Taymans 2026-04-08 12:00:04 +02:00
parent fbbc4271a3
commit 7012594926
2 changed files with 4 additions and 4 deletions

View file

@ -262,10 +262,10 @@ static int load_ladspa_plugin(struct plugin *impl, const char *path, const char
while ((p = split_walk(search_dirs, ":", &len, &state))) {
int namelen;
if (len >= sizeof(filename))
if (len == 0 || len >= sizeof(filename))
continue;
if (strncmp(path, p, len) == 0)
if (strncmp(path, p, len) == 0 && path[len] == '/')
namelen = snprintf(filename, sizeof(filename), "%s", path);
else
namelen = snprintf(filename, sizeof(filename), "%.*s/%s.so", (int) len, p, path);