]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: promex: Always limit the number of labels dumped for each metric
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 29 Jan 2024 16:19:28 +0000 (17:19 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 1 Feb 2024 11:00:54 +0000 (12:00 +0100)
It was not an issue since now, be a way to register modules on promex will
be added. Thus it is important to add some extra checks. Here, we take care
to never dump more than the max labels allowed.

addons/promex/service-prometheus.c

index 5cdad6a4afa242d645f40a2396d5f457adb2a91c..bf6fd7600114330e88f2e19157e67b800bb73d12 100644 (file)
@@ -536,7 +536,7 @@ static int promex_dump_metric(struct appctx *appctx, struct htx *htx, struct ist
                if (istcat(out, ist("{"), max) == -1)
                        goto full;
 
-               for (i = 0; isttest(labels[i].name); i++) {
+               for (i = 0; i < PROMEX_MAX_LABELS && isttest(labels[i].name); i++) {
                        if (!isttest(labels[i].value))
                                continue;