From 8ad8e789fc03423a9f1d33051b592419399184bb Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 20 Apr 2012 21:27:26 +0200 Subject: mkfs: avoid heap-buffer-read-underrun for zero-length "size" arg * mkfs.c (parse_size): ./mkfs.btrfs -A '' would read and possibly write the byte before beginning of strdup'd heap buffer. All other size-accepting options were similarly affected. Reviewed-by: Josef Bacik --- cmds-subvolume.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmds-subvolume.c') diff --git a/cmds-subvolume.c b/cmds-subvolume.c index fc749f12..a01c830d 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c @@ -380,7 +380,7 @@ static int cmd_snapshot(int argc, char **argv) args.fd = fd; strncpy(args.name, newname, BTRFS_SUBVOL_NAME_MAX); - args.name[BTRFS_PATH_NAME_MAX-1] = 0; + args.name[BTRFS_SUBVOL_NAME_MAX-1] = 0; res = ioctl(fddst, BTRFS_IOC_SNAP_CREATE_V2, &args); e = errno; -- cgit v1.2.3