From: Christopher Faulet Date: Mon, 29 Jan 2024 16:19:28 +0000 (+0100) Subject: MINOR: promex: Always limit the number of labels dumped for each metric X-Git-Tag: v3.0-dev3~105 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5a48a94dcc6debe94cf9955c5a5c6652b3bd7411;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/addons/promex/service-prometheus.c b/addons/promex/service-prometheus.c index 5cdad6a4af..bf6fd76001 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;