]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: flt-trace: Support only one name option
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 6 Feb 2025 16:01:08 +0000 (17:01 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 6 Feb 2025 16:01:15 +0000 (17:01 +0100)
When a trace filter is defined, only one 'name' option is expected. But it
was not tested. Thus it was possible to set several names leading to a
memory leak.

It is now tested, and it is not allowed to redefine the trace filter name.

It was reported by Coverity in #2841: CID 1587768.

This patch could be backported to all stable versions.

src/flt_trace.c

index bbadfe24cdd23eb9fb7bf7cdd510e069d82a61ab..3703dede5cccb9fee69deacf96fbbddbde0f43ff 100644 (file)
@@ -631,6 +631,11 @@ parse_trace_flt(char **args, int *cur_arg, struct proxy *px,
                                                  args[*cur_arg], args[pos]);
                                        goto error;
                                }
+                               if (conf->name) {
+                                       memprintf(err, "'%s' : '%s' option already defined",
+                                                 args[*cur_arg], args[pos]);
+                                       goto error;
+                               }
                                conf->name = strdup(args[pos + 1]);
                                if (!conf->name) {
                                        memprintf(err, "%s: out of memory", args[*cur_arg]);