ucm: fix parsing of the internal hexadecimal card identifier

Too many code was removed.

Fixes: f547b2e3 ("conf: introduce safe_strtol_base()")
Fixes: https://github.com/alsa-project/alsa-lib/issues/188
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2021-11-12 15:59:28 +01:00
parent ea5481296f
commit 050f18c525

View file

@ -811,6 +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];
long card_num;
snd_config_t *config;
snd_use_case_mgr_t *uc_mgr;
@ -818,6 +819,8 @@ 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';
err = safe_strtol_base(name, &card_num, 16);
if (err < 0 || card_num < 0 || card_num > 0xffff)
return NULL;