From: Andre Noll Date: Tue, 13 Jun 2017 20:09:01 +0000 (+0200) Subject: audiod: Fix off-by-one bug in init_default_filters(). X-Git-Tag: v0.6.1~74 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=73eea97d6501c90f37d44e9f2a31bb6defe2e338;p=paraslash.git 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. --- 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);