From: Christopher Faulet Date: Wed, 28 Sep 2022 16:22:23 +0000 (+0200) Subject: Revert "BUG/MINOR: config: don't count trailing spaces as empty arg" X-Git-Tag: v2.7-dev7~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c5daf2801a76ed56743c25fb6a35dee77440c6bc;p=thirdparty%2Fhaproxy.git Revert "BUG/MINOR: config: don't count trailing spaces as empty arg" This reverts commit 5529424ef1c9aae4ca714a99ffca2082e533781f. Since this patch, HAProxy crashes when the first line of the configuration file contains more than one parameter because, on the first call of parse_line(), the output line is not allocated. Thus elements in the arguments array may point on invalid memory area. It may be considered as a bug to reference invalid memory area and should be fixed. But for now, it is safer to revert this patch If the reverted commit is backported, this one must be backported too. --- diff --git a/src/tools.c b/src/tools.c index 699021fab8..f697eaccb9 100644 --- a/src/tools.c +++ b/src/tools.c @@ -5750,10 +5750,7 @@ uint32_t parse_line(char *in, char *out, size_t *outlen, char **args, int *nbarg /* end of output string */ EMIT_CHAR(0); - - /* don't add empty arg after trailing spaces */ - if (arg < argsmax && args[arg] && *(args[arg])) - arg++; + arg++; if (quote) { /* unmatched quote */