From bfd25a4a46cda204d759a62269f198ad0354ca23 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 24 Jan 2024 15:08:14 +0100 Subject: [PATCH] fix: df plugin: Fix an array out of bounds crash. The second argument of the `for` loop always evaluated to true, causing the code to read past the end of the array. ChangeLog: df plugin: An out of bounds read, causing segmentation faults, has been fixed. --- src/df.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/df.c b/src/df.c index fb81a1bb86..bb12519d0d 100644 --- a/src/df.c +++ b/src/df.c @@ -332,7 +332,7 @@ static int df_read(void) { &fam_inode_utilization, }; - for (size_t i = 0; STATIC_ARRAY_SIZE(families); i++) { + for (size_t i = 0; i < STATIC_ARRAY_SIZE(families); i++) { if (families[i]->metric.num == 0) { continue; }