From 5529424ef1c9aae4ca714a99ffca2082e533781f Mon Sep 17 00:00:00 2001 From: Erwan Le Goas Date: Fri, 23 Sep 2022 15:06:34 +0200 Subject: [PATCH] BUG/MINOR: config: don't count trailing spaces as empty arg In parse_line(), spaces increment the arg count and it is incremented again on '#' or end of line, resulting in an extra empty arg at the end of arg's list. The visible effect is that the reported arg count is in excess of 1. It doesn't seem to affect regular function but specialized ones like anonymisation depends on this count. This may need to be backported to stable versions. --- src/tools.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools.c b/src/tools.c index f697eaccb9..699021fab8 100644 --- a/src/tools.c +++ b/src/tools.c @@ -5750,7 +5750,10 @@ uint32_t parse_line(char *in, char *out, size_t *outlen, char **args, int *nbarg /* end of output string */ EMIT_CHAR(0); - arg++; + + /* don't add empty arg after trailing spaces */ + if (arg < argsmax && args[arg] && *(args[arg])) + arg++; if (quote) { /* unmatched quote */ -- 2.47.3