[CRIU] [PATCH 06/18] zdtm/lib: fix a case when a string may be unterminated

Andrei Vagin avagin at openvz.org
Thu Nov 9 22:21:00 MSK 2017


From: Andrei Vagin <avagin at virtuozzo.com>

CID 153098 (#3 of 3): Buffer not null terminated (BUFFER_SIZE_WARNING)
10. buffer_size_warning: Calling strncpy with a maximum size argument of 64 bytes on destination array m->fsname of size 64 bytes might leave the destination string unterminated.

Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 test/zdtm/lib/fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/zdtm/lib/fs.c b/test/zdtm/lib/fs.c
index 37f5e4191..e2da2a3bf 100644
--- a/test/zdtm/lib/fs.c
+++ b/test/zdtm/lib/fs.c
@@ -34,7 +34,7 @@ mnt_info_t *get_cwd_mnt_info(void)
 
 	mnt_info_t *m = NULL;
 
-	char mountpoint[PATH_MAX];
+	char mountpoint[64];
 	char root[PATH_MAX];
 
 	char *fsname = NULL;
-- 
2.13.6



More information about the CRIU mailing list