Skip to content

Commit 7d010b8

Browse files
committed
Use proper length for mountp string
We read 256 chars for the mountpoint name to (try to) be sure to get it all, and so ths statvfs() function won't fail in read_filesystem() function. Yet only MAX_FS_LEN chars should be saved in stats_filesystem structure. Signed-off-by: Sebastien GODARD <[email protected]>
1 parent 6390688 commit 7d010b8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rd_stats.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2112,7 +2112,8 @@ void read_filesystem(struct stats_filesystem *st_filesystem, int nbr)
21122112
st_filesystem_i->f_files = buf.f_files;
21132113
st_filesystem_i->f_ffree = buf.f_ffree;
21142114
strcpy(st_filesystem_i->fs_name, fs_name);
2115-
strcpy(st_filesystem_i->mountp, mountp);
2115+
strncpy(st_filesystem_i->mountp, mountp, MAX_FS_LEN);
2116+
st_filesystem_i->mountp[MAX_FS_LEN - 1] = '\0';
21162117
}
21172118
}
21182119

0 commit comments

Comments
 (0)