From: Egor Shestakov Date: Thu, 15 Jan 2026 15:41:37 +0000 (+0000) Subject: BUG/MINOR: cfgparse: fix "default" prefix parsing X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=447d73dc99fde7b8ec2e6cc964817ed6563fce5e;p=thirdparty%2Fhaproxy.git BUG/MINOR: cfgparse: fix "default" prefix parsing Fix the left shift of args when "default" prefix matches. The cause of the bug was the absence of zeroing of the right element during the shift. The same bug for "no" prefix was fixed by commit 0f99e3497, but missed for "default". The shift of ("default", "option", "dontlog-normal") produced ("option", "dontlog-normal", "dontlog-normal") instead of ("option", "dontlog-normal", "") As an example, a valid config line: default option dontlog-normal caused a parse error: [ALERT] (32914) : config : parsing [bug-default-prefix.cfg:22] : 'option dontlog-normal' cannot handle unexpected argument 'dontlog-normal'. The patch should be backported to all stable versions, since the absence of zeroing was introduced with "default" keyword. --- diff --git a/src/cfgparse.c b/src/cfgparse.c index 5f6d92162..ca09f25c5 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -2684,9 +2684,14 @@ next_line: args[arg] = tmp; } else if (strcmp(args[0], "default") == 0) { + char *tmp; + kwm = KWM_DEF; + tmp = args[0]; for (arg=0; *args[arg+1]; arg++) args[arg] = args[arg+1]; // shift args after inversion + *tmp = '\0'; + args[arg] = tmp; } if (kwm != KWM_STD && strcmp(args[0], "option") != 0 &&