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 pw-dump
Memory Safety: Medium In the registry event handler, strdup(type) was not checked for failure. A NULL o->type would cause NULL pointer dereferences in subsequent code that uses the type string for comparison and logging. Fix by checking the strdup() return value and cleaning up on failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
43931caccb
commit
ec04c4bf9a
1 changed files with 5 additions and 0 deletions
|
|
@ -1215,6 +1215,11 @@ static void registry_event_global(void *data, uint32_t id,
|
||||||
o->id = id;
|
o->id = id;
|
||||||
o->permissions = permissions;
|
o->permissions = permissions;
|
||||||
o->type = strdup(type);
|
o->type = strdup(type);
|
||||||
|
if (o->type == NULL) {
|
||||||
|
pw_log_error("can't alloc type for %u %s/%d: %m", id, type, version);
|
||||||
|
free(o);
|
||||||
|
return;
|
||||||
|
}
|
||||||
o->version = version;
|
o->version = version;
|
||||||
o->props = props ? pw_properties_new_dict(props) : NULL;
|
o->props = props ? pw_properties_new_dict(props) : NULL;
|
||||||
spa_list_init(&o->param_list);
|
spa_list_init(&o->param_list);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue