]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: arg: report an error if an argument is larger than bufsize
authorWilly Tarreau <w@1wt.eu>
Sat, 15 Feb 2020 13:54:28 +0000 (14:54 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 15 Feb 2020 13:54:28 +0000 (14:54 +0100)
Commit ef21facd99 ("MEDIUM: arg: make make_arg_list() support quotes
in arguments") removed the chunk_strncpy() to fill the trash buffer
as the input is being parsed, and accidently dropped the jump to the
error path in case the argument is too large, which is now fixed.

No backport is needed, this is for 2.2. This addresses issue #502.

src/arg.c

index 3843a9b25193b0108eb82280efa264ca0ebb808d..dffbb2efe9ec63a760a2150fcb79de11fcce2d90 100644 (file)
--- a/src/arg.c
+++ b/src/arg.c
@@ -213,6 +213,10 @@ int make_arg_list(const char *in, int len, uint64_t mask, struct arg **argp,
                        }
                        trash.data = out - trash.area;
                }
+
+               if (len && *in)
+                       goto buffer_err;
+
                trash.area[trash.data] = 0;
 
                arg->type = (mask >> (pos * ARGT_BITS)) & ARGT_MASK;