From 5a48a94dcc6debe94cf9955c5a5c6652b3bd7411 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 29 Jan 2024 17:19:28 +0100 Subject: [PATCH] MINOR: promex: Always limit the number of labels dumped for each metric 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/promex/service-prometheus.c b/addons/promex/service-prometheus.c index 5cdad6a4a..bf6fd7600 100644 --- a/addons/promex/service-prometheus.c +++ b/addons/promex/service-prometheus.c @@ -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;