summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2008-01-27 15:45:30 -0500
committerTheodore Ts'o <tytso@mit.edu>2008-01-27 15:45:30 -0500
commitdf200fffd5276d3c8ba201fd61858ba906b77cf6 (patch)
tree1dace681e59f72da07ad6010988dae431c3d13d9 /misc
parentc2dbc18a9425815b6e93eb8b95d05a1168fb6e23 (diff)
downloade2fsprogs-df200fffd5276d3c8ba201fd61858ba906b77cf6.tar.gz
e2image: Fix potential overflow if the device name is too long
Adapted from SLES's patch: e2fsprogs-strncat.patch Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'misc')
-rw-r--r--misc/e2image.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/misc/e2image.c b/misc/e2image.c
index f17b7849..4313cc0c 100644
--- a/misc/e2image.c
+++ b/misc/e2image.c
@@ -126,7 +126,7 @@ static void write_image_file(ext2_filsys fs, int fd)
hdr.magic_number = EXT2_ET_MAGIC_E2IMAGE;
strcpy(hdr.magic_descriptor, "Ext2 Image 1.0");
gethostname(hdr.fs_hostname, sizeof(hdr.fs_hostname));
- strncat(hdr.fs_device_name, device_name, sizeof(hdr.fs_device_name));
+ strncpy(hdr.fs_device_name, device_name, sizeof(hdr.fs_device_name)-1);
hdr.fs_device_name[sizeof(hdr.fs_device_name) - 1] = 0;
hdr.fs_blocksize = fs->blocksize;