summaryrefslogtreecommitdiff
path: root/btrfslabel.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-04-20 21:27:25 +0200
committerHugo Mills <hugo@carfax.org.uk>2012-06-05 19:56:20 +0100
commit54e345b5c2339dee170595f686dbd26937620262 (patch)
treeb1b5c2267023e9d117906d979a042536c17b0d31 /btrfslabel.c
parent47f029cc8bcf5a03ef6ee939fcb64007aafa50c4 (diff)
avoid several strncpy-induced buffer overruns
* restore.c (main): Ensure strncpy-copied dir_name is NUL-terminated. * btrfsctl.c (main): Likewise, for a command-line argument. * utils.c (multiple functions): Likewise. * btrfs-list.c (add_root): Likewise. * btrfslabel.c (change_label_unmounted): Likewise. * cmds-device.c (cmd_add_dev, cmd_rm_dev, cmd_scan_dev): Likewise. * cmds-filesystem.c (cmd_resize): Likewise. * cmds-subvolume.c (cmd_subvol_create, cmd_subvol_delete, cmd_snapshot): Likewise. Reviewed-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'btrfslabel.c')
-rw-r--r--btrfslabel.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/btrfslabel.c b/btrfslabel.c
index c9f46844..da694e1d 100644
--- a/btrfslabel.c
+++ b/btrfslabel.c
@@ -58,6 +58,7 @@ static void change_label_unmounted(char *dev, char *nLabel)
trans = btrfs_start_transaction(root, 1);
strncpy(root->fs_info->super_copy.label, nLabel, BTRFS_LABEL_SIZE);
+ root->fs_info->super_copy.label[BTRFS_LABEL_SIZE-1] = 0;
btrfs_commit_transaction(trans, root);
/* Now we close it since we are done. */