mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-03 09:01:52 -05:00
ucm: fix the parsing of the hexadecimal prefix
The safe_strtol() function use strtol() which expects to have the '0x' prefix for the hexadecimal number (when base argument is zero). BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1553 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
7d40a76ef5
commit
4a52ae4c32
1 changed files with 5 additions and 3 deletions
|
|
@ -811,7 +811,7 @@ void uc_mgr_card_close(snd_use_case_mgr_t *uc_mgr)
|
|||
*/
|
||||
const char *uc_mgr_alibcfg_by_device(snd_config_t **top, const char *name)
|
||||
{
|
||||
char buf[5];
|
||||
char buf[7];
|
||||
long card_num;
|
||||
snd_config_t *config;
|
||||
snd_use_case_mgr_t *uc_mgr;
|
||||
|
|
@ -819,8 +819,10 @@ const char *uc_mgr_alibcfg_by_device(snd_config_t **top, const char *name)
|
|||
|
||||
if (strncmp(name, "_ucm", 4) || strlen(name) < 12 || name[8] != '.')
|
||||
return NULL;
|
||||
strncpy(buf, name + 4, 4);
|
||||
buf[4] = '\0';
|
||||
buf[0] = '0';
|
||||
buf[1] = 'x';
|
||||
strncpy(buf + 2, name + 4, 4);
|
||||
buf[6] = '\0';
|
||||
err = safe_strtol(buf, &card_num);
|
||||
if (err < 0 || card_num < 0 || card_num > 0xffff)
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue