]> granicus.if.org Git - sysstat/commitdiff
Use proper length for mountp string
authorSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 27 Mar 2015 15:52:27 +0000 (16:52 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 27 Mar 2015 15:56:57 +0000 (16:56 +0100)
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 <sysstat@users.noreply.github.com>
rd_stats.c

index 48e4b53ea3dcee76e08eec4cbfb0683fc0b23311..83e389e143db5b2fea5af6ba7a7903611f6b1cea 100644 (file)
@@ -2112,7 +2112,8 @@ void read_filesystem(struct stats_filesystem *st_filesystem, int nbr)
                        st_filesystem_i->f_files  = buf.f_files;
                        st_filesystem_i->f_ffree  = buf.f_ffree;
                        strcpy(st_filesystem_i->fs_name, fs_name);
-                       strcpy(st_filesystem_i->mountp, mountp);
+                       strncpy(st_filesystem_i->mountp, mountp, MAX_FS_LEN);
+                       st_filesystem_i->mountp[MAX_FS_LEN - 1] = '\0';
                }
        }