mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-02 06:46:36 -04:00
security: add missing NULL check after strdup in MIDI server
Memory Safety: Medium spa_bt_midi_server_new() did not check the return value of strdup() when duplicating the characteristic path. On allocation failure, a NULL chr_path would be returned as part of the server object, leading to a NULL pointer dereference when later used. Add a NULL check that jumps to the existing fail cleanup path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
acabcf085d
commit
bc93a745ab
1 changed files with 4 additions and 0 deletions
|
|
@ -526,6 +526,10 @@ struct spa_bt_midi_server *spa_bt_midi_server_new(const struct spa_bt_midi_serve
|
|||
|
||||
spa_scnprintf(path, sizeof(path), MIDI_CHR_PATH, impl->server_id);
|
||||
impl->this.chr_path = strdup(path);
|
||||
if (impl->this.chr_path == NULL) {
|
||||
res = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return &impl->this;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue