From: Theodore Ts'o Date: Thu, 10 Jul 2014 19:33:57 +0000 (-0400) Subject: mke2fs: fix fencepost error when calling strncat X-Git-Tag: v1.42.11.wc1~44 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=30db7954c7165bc77693054f135a1466f2594027;p=tools%2Fe2fsprogs.git 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 --- 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;