mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa: be safer when parsing device string
This commit is contained in:
parent
154f981f97
commit
e478ba7e34
1 changed files with 5 additions and 2 deletions
|
|
@ -821,10 +821,13 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
reset_props(&this->props);
|
||||
|
||||
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_ALSA_PATH)))
|
||||
snprintf(this->props.device, 64, "%s", str);
|
||||
snprintf(this->props.device, sizeof(this->props.device)-1, "%s", str);
|
||||
|
||||
spa_log_debug(this->log, "probe card %s", this->props.device);
|
||||
this->card = acp_card_new(atoi(this->props.device+3), NULL);
|
||||
if ((str = strchr(this->props.device, ':')) == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
this->card = acp_card_new(atoi(str+1), NULL);
|
||||
if (this->card == NULL)
|
||||
return -errno;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue