Skip to content

Commit

Permalink
fix: df plugin: Fix an array out of bounds crash.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
octo committed Jan 24, 2024
1 parent 2171581 commit bfd25a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/df.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit bfd25a4

Please sign in to comment.