summaryrefslogtreecommitdiff
path: root/cmds-subvolume.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2015-06-12 14:36:51 +0200
committerDavid Sterba <dsterba@suse.cz>2015-06-12 16:44:48 +0200
commit6a039e5063fc96cc72a0a0b2bdc97403fb080de1 (patch)
tree162acdd186f1c1bbdba875ebf470f33a67f691e1 /cmds-subvolume.c
parent2e151027d245a762326dac8e814db9fc59113454 (diff)
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 'cmds-subvolume.c')
-rw-r--r--cmds-subvolume.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index dfc3f1f3..e88a6e6e 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -357,6 +357,7 @@ again:
printf("Delete subvolume (%s): '%s/%s'\n",
commit_mode == 2 || (commit_mode == 1 && cnt + 1 == argc)
? "commit" : "no-commit", dname, vname);
+ memset(&args, 0, sizeof(args));
strncpy_null(args.name, vname);
res = ioctl(fd, BTRFS_IOC_SNAP_DESTROY, &args);
e = errno;