mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-03 06:47:04 -04:00
security: add missing NULL check after strdup in reserve
Memory Safety: Medium rd_device_new() did not check the return value of strdup() when duplicating application_name. On allocation failure, a NULL pointer would be stored and later passed to D-Bus functions, causing a crash. Add a NULL check that jumps to the existing error_free cleanup path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4de0f83aca
commit
c3c1216633
1 changed files with 4 additions and 0 deletions
|
|
@ -357,6 +357,10 @@ rd_device_new(DBusConnection *connection, const char *device_name, const char *a
|
||||||
d->data = data;
|
d->data = data;
|
||||||
|
|
||||||
d->application_name = strdup(application_name);
|
d->application_name = strdup(application_name);
|
||||||
|
if (d->application_name == NULL) {
|
||||||
|
res = -ENOMEM;
|
||||||
|
goto error_free;
|
||||||
|
}
|
||||||
|
|
||||||
d->object_path = spa_aprintf(OBJECT_PREFIX "%s", device_name);
|
d->object_path = spa_aprintf(OBJECT_PREFIX "%s", device_name);
|
||||||
if (d->object_path == NULL) {
|
if (d->object_path == NULL) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue