From 30db7954c7165bc77693054f135a1466f2594027 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 10 Jul 2014 15:33:57 -0400 Subject: [PATCH] mke2fs: fix fencepost error when calling strncat There were other protections which would prevent a buffer overflow from happening, but we should fix this nevertheless. Addresses-Coverity-Bug: #1225003 Signed-off-by: Theodore Ts'o --- misc/mk_hugefiles.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/mk_hugefiles.c b/misc/mk_hugefiles.c index ea42b6c..41280f0 100644 --- a/misc/mk_hugefiles.c +++ b/misc/mk_hugefiles.c @@ -188,7 +188,7 @@ static blk64_t get_partition_start(const char *device_name) cp = search_sysfs_block(st.st_rdev, path); if (!cp) return 0; - strncat(path, "/start", SYSFS_PATH_LEN); + strncat(path, "/start", SYSFS_PATH_LEN-1); f = fopen(path, "r"); if (!f) return 0; -- 1.8.3.1