Fix a buffer overflow.

Signed-off-by: Jan Engelhardt <[EMAIL PROTECTED]>

---
 utils.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: btrfs-progs-0.11/utils.c
===================================================================
--- btrfs-progs-0.11.orig/utils.c
+++ btrfs-progs-0.11/utils.c
@@ -63,7 +63,7 @@ int make_btrfs(int fd, u64 blocks[4], u6
        num_bytes = (num_bytes / sectorsize) * sectorsize;
        uuid_generate(super.fsid);
        btrfs_set_super_bytenr(&super, blocks[0]);
-       strcpy((char *)(&super.magic), BTRFS_MAGIC);
+       strncpy((char *)&super.magic, BTRFS_MAGIC, sizeof(super.magic));
        btrfs_set_super_generation(&super, 1);
        btrfs_set_super_root(&super, blocks[1]);
        btrfs_set_super_total_bytes(&super, num_bytes);


_______________________________________________
Btrfs-devel mailing list
[email protected]
http://oss.oracle.com/mailman/listinfo/btrfs-devel

Reply via email to