mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-29 06:46:38 -04:00
security: add missing NULL check after strdup in context factory registry
Memory Safety: Medium In pw_context_set_spa_libs(), strdup(lib) was not checked for failure. A NULL entry->lib would cause a NULL dereference when the factory library path is later looked up and used for dlopen(). Fix by checking the strdup() return value and cleaning up the regex and array entry on failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
640af6b20f
commit
43931caccb
1 changed files with 5 additions and 0 deletions
|
|
@ -1030,6 +1030,11 @@ int pw_context_add_spa_lib(struct pw_context *context,
|
|||
}
|
||||
|
||||
entry->lib = strdup(lib);
|
||||
if (entry->lib == NULL) {
|
||||
regfree(&entry->regex);
|
||||
pw_array_remove(&context->factory_lib, entry);
|
||||
return -ENOMEM;
|
||||
}
|
||||
pw_log_debug("%p: map factory regex '%s' to '%s", context,
|
||||
factory_regexp, lib);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue