From 9910c69dbcb1e50c51061b5564e86573020ff629 Mon Sep 17 00:00:00 2001 From: Faran Abdullah Date: Wed, 9 Oct 2024 12:36:48 +0500 Subject: [PATCH] in_node_exporter_metrics: Fix size of core_throttles_set in ne_cpu_linux.c In core_throttles_set[n][m], n has size 32 only. On my PC, I have 44 cores and physical_package_id can have max value of 88. On line 140 we see: if (core_throttles_set[physical_package_id][core_id] != 0) This causes a segmentation fault as we access data from invalid address outside the range of buffer. The size is changed to 256 to accomodate high core count. Signed-off-by: Faran Abdullah faran.abdullah@ebryx.com Signed-off-by: Faran Abdullah --- plugins/in_node_exporter_metrics/ne_cpu_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/in_node_exporter_metrics/ne_cpu_linux.c b/plugins/in_node_exporter_metrics/ne_cpu_linux.c index 64b404d354a..7656e596dde 100644 --- a/plugins/in_node_exporter_metrics/ne_cpu_linux.c +++ b/plugins/in_node_exporter_metrics/ne_cpu_linux.c @@ -98,7 +98,7 @@ static int cpu_thermal_update(struct flb_ne *ctx, uint64_t ts) struct flb_slist_entry *entry; const char *pattern = "/devices/system/cpu/cpu[0-9]*"; /* Status arrays */ - uint64_t core_throttles_set[32][256]; + uint64_t core_throttles_set[256][256]; uint64_t package_throttles_set[32]; ret = ne_utils_path_scan(ctx, ctx->path_sysfs, pattern, NE_SCAN_DIR, &list);