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>
diff --git a/misc/e2image.c b/misc/e2image.c
index f17b784..4313cc0 100644
--- a/misc/e2image.c
+++ b/misc/e2image.c
@@ -126,7 +126,7 @@
 	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;