From 73eea97d6501c90f37d44e9f2a31bb6defe2e338 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 13 Jun 2017 22:09:01 +0200 Subject: [PATCH] audiod: Fix off-by-one bug in init_default_filters(). Filter numbers are one-based because zero is the number of the (non-existing) supercommand of the filter_cmd suite. The loop in init_default_filters() gets this wrong. This bites only if no filter is given for at least one audio format. Fortunately, the bug was easy to find because it triggers an assertion in filter_get() which checks that the given number is at least one. --- audiod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audiod.c b/audiod.c index ead29e86..74d0ce23 100644 --- a/audiod.c +++ b/audiod.c @@ -1001,7 +1001,7 @@ static int init_default_filters(void) } /* add "dec" to audio format name */ tmp = make_message("%sdec", audio_formats[i]); - for (j = 0; filter_get(j); j++) + for (j = 1; filter_get(j); j++) if (!strcmp(tmp, filter_name(j))) break; free(tmp); -- 2.39.5