diff options
author | David Sterba <dsterba@suse.cz> | 2015-06-12 14:36:51 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2015-06-12 16:44:48 +0200 |
commit | 6a039e5063fc96cc72a0a0b2bdc97403fb080de1 (patch) | |
tree | 162acdd186f1c1bbdba875ebf470f33a67f691e1 /utils.c | |
parent | 2e151027d245a762326dac8e814db9fc59113454 (diff) | |
download | btrfs-progs-6a039e5063fc96cc72a0a0b2bdc97403fb080de1.tar.gz |
btrfs-progs: properly set up ioctl arguments
At some places we do not clear the whole ioctl structure and could
pass garbage to kernel. Zero the ioctl vol_args and use a helper for
copying the path.
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1409,8 +1409,8 @@ int btrfs_register_one_device(const char *fname) strerror(errno)); return -errno; } - strncpy(args.name, fname, BTRFS_PATH_NAME_MAX); - args.name[BTRFS_PATH_NAME_MAX-1] = 0; + memset(&args, 0, sizeof(args)); + strncpy_null(args.name, fname); ret = ioctl(fd, BTRFS_IOC_SCAN_DEV, &args); e = errno; if (ret < 0) { |