]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
mke2fs: fix fencepost error when calling strncat
authorTheodore Ts'o <tytso@mit.edu>
Thu, 10 Jul 2014 19:33:57 +0000 (15:33 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 10 Jul 2014 19:33:57 +0000 (15:33 -0400)
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 <tytso@mit.edu>
misc/mk_hugefiles.c

index ea42b6cb6094e5cc39166f52818fa10421df34b1..41280f08e4a5cf435524588ab99ece901b188433 100644 (file)
@@ -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;