diff options
author | Jan Engelhardt <jengelh@computergmbh.de> | 2008-01-22 11:32:06 -0500 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2008-01-22 11:32:06 -0500 |
commit | 4408248634ecf2b4c1e246b9fd0c770984f69aae (patch) | |
tree | abd44ce0c2af1d82fa411ff25cfe4a7116f5e551 /utils.c | |
parent | 7c2844538143aebb26f0436c2760172017901536 (diff) |
btrfs-progs: fix a buffer overflow during mkfs
Using strncpy avoids a 1 byte overflow into the next field
of the struct. The overflow is harmless, but does
trip automated tools.
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
---
utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -63,7 +63,7 @@ int make_btrfs(int fd, u64 blocks[4], u64 num_bytes, u32 nodesize, 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); |