Tim, Max,
On Sun, Jun 06, 2021 at 12:50:22AM +0200, Maximilian Mader wrote:
> This is a cleaned-up version of Tim's PoC patch.
> The documentation has been updated to reflect the changes.
> A simple VTest test is included as well. Note the use of VTest's cmd
> feature to skip the test if the HAProxy version is lower than specified.
> It might be useful for future tests as well.
I had to apply a minor change to this one because it was randomly failing
on me:
$ ./haproxy -cc 'version_atleast(2.4)'
[NOTICE] (2890) : haproxy version is 2.5-dev0-e5a8e5-99
[NOTICE] (2890) : path to executable is ./haproxy
[ALERT] (2890) : config : Error in condition: Line too long.
I couldn't figure how the VTC was OK but not testing it by hand. I finally
found it, the outlen variable was not initialized, it should contain the
size of the allocated area for the output, so if there was some dirt in
the stack, it would use that and be happy, but when run by hand it had
zero, hence the message above :-)
The change I performed to fix it was just this, and now it always
works:
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -1804,7 +1804,7 @@ static void init(int argc, char **argv)
char *args[MAX_LINE_ARGS+1];
int arg = sizeof(args) / sizeof(*args);
- size_t outlen;
+ size_t outlen = strlen(check_condition) + 1;
err = parse_line(check_condition, check_condition, &outlen,
args, &arg,
PARSE_OPT_DQUOTE | PARSE_OPT_SQUOTE |
PARSE_OPT_BKSLASH,
The series is applied now, thanks!
Willy