From: Florian Forster Date: Wed, 24 Jan 2024 14:08:14 +0000 (+0100) Subject: fix: df plugin: Fix an array out of bounds crash. X-Git-Tag: collectd-6.0.0.rc1~3^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bfd25a4a46cda204d759a62269f198ad0354ca23;p=thirdparty%2Fcollectd.git 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. --- diff --git a/src/df.c b/src/df.c index fb81a1bb8..bb12519d0 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; }