conf: fix parse_array_def override code path
Some checks failed
Build alsa-lib / fedora_latest_build (push) Has been cancelled
Build alsa-lib / ubuntu_last_build (push) Has been cancelled

The error may cause segmentation fault and incorrect behaviour.

Closes: https://github.com/alsa-project/alsa-lib/issues/477
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2025-09-18 11:00:47 +02:00
parent 3a97718124
commit d62b1d5407

View file

@ -1268,13 +1268,13 @@ static int parse_array_def(snd_config_t *parent, input_t *input, int *idx, int s
snd_config_t *n = NULL; snd_config_t *n = NULL;
if (!skip) { if (!skip) {
snd_config_t *g;
char static_id[12]; char static_id[12];
while (1) { while (1) {
snprintf(static_id, sizeof(static_id), "%i", *idx); snprintf(static_id, sizeof(static_id), "%i", *idx);
if (_snd_config_search(parent, static_id, -1, &g) == 0) { if (_snd_config_search(parent, static_id, -1, &n) == 0) {
if (override) { if (override) {
snd_config_delete(n); snd_config_delete(n);
n = NULL;
} else { } else {
/* merge */ /* merge */
(*idx)++; (*idx)++;