Blame SOURCES/0017-Use-proper-length-for-mountp-string.patch

9a8d55
From 41683b8609f5dea3cb3ae791a8889c86c668d205 Mon Sep 17 00:00:00 2001
9a8d55
From: Sebastien GODARD <sysstat@users.noreply.github.com>
9a8d55
Date: Fri, 27 Mar 2015 16:52:27 +0100
9a8d55
Subject: [PATCH] Use proper length for mountp string
9a8d55
9a8d55
We read 256 chars for the mountpoint name to (try to) be sure to get it
9a8d55
all, and so ths statvfs() function won't fail in read_filesystem()
9a8d55
function.
9a8d55
Yet only MAX_FS_LEN chars should be saved in stats_filesystem structure.
9a8d55
9a8d55
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
9a8d55
(cherry picked from commit 7d010b8b3646e1d87427aca13feb16ac890d7c4c)
9a8d55
---
9a8d55
 rd_stats.c | 3 ++-
9a8d55
 1 file changed, 2 insertions(+), 1 deletion(-)
9a8d55
9a8d55
diff --git a/rd_stats.c b/rd_stats.c
9a8d55
index cb45d82..f288eb8 100644
9a8d55
--- a/rd_stats.c
9a8d55
+++ b/rd_stats.c
9a8d55
@@ -1956,7 +1956,8 @@ void read_filesystem(struct stats_filesystem *st_filesystem, int nbr)
9a8d55
 			st_filesystem_i->f_files  = buf.f_files;
9a8d55
 			st_filesystem_i->f_ffree  = buf.f_ffree;
9a8d55
 			strcpy(st_filesystem_i->fs_name, fs_name);
9a8d55
-			strcpy(st_filesystem_i->mountp, mountp);
9a8d55
+			strncpy(st_filesystem_i->mountp, mountp, MAX_FS_LEN);
9a8d55
+			st_filesystem_i->mountp[MAX_FS_LEN - 1] = '\0';
9a8d55
 		}
9a8d55
 	}
9a8d55
 
9a8d55
-- 
9a8d55
2.14.3
9a8d55