]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: cfgparse: Remove duplication of `MAX_LINE_ARGS + 1`
authorTim Duesterhus <tim@bastelstu.be>
Sat, 5 Jun 2021 22:50:20 +0000 (00:50 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 8 Jun 2021 08:54:30 +0000 (10:54 +0200)
We can calculate the number of possible arguments based off the size of the
`args` array. We should do so to prevent the two values from getting out of
sync.

src/cfgparse.c

index b1274cdb809cef64838d6a5bfbc7ab1fffd6883d..fa2072a83173bfa095dee6e6795c88a226ceb3e1 100644 (file)
@@ -1961,7 +1961,7 @@ next_line:
                        uint32_t err;
                        char *errptr;
 
-                       arg = MAX_LINE_ARGS + 1;
+                       arg = sizeof(args) / sizeof(*args);
                        outlen = outlinesize;
                        err = parse_line(line, outline, &outlen, args, &arg,
                                         PARSE_OPT_ENV | PARSE_OPT_DQUOTE | PARSE_OPT_SQUOTE |