Skip to content

Commit 061e156

Browse files
committed
btrfs-progs: subvol list: fix accidental trimming of subvolume name
Commit 4db9259 ("btrfs-progs: use strncpy_null everywhere") did not properly convert the subvolume name copying to strncpy_null() and trimmed the last character. Issue: #829 Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 4f88e01 commit 061e156

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmds/subvolume-list.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ static int update_root(struct rb_root *root_lookup,
547547
error_msg(ERROR_MSG_MEMORY, NULL);
548548
exit(1);
549549
}
550-
strncpy_null(ri->name, name, name_len);
550+
strncpy_null(ri->name, name, name_len + 1);
551551
}
552552
if (ref_tree)
553553
ri->ref_tree = ref_tree;
@@ -618,7 +618,7 @@ static int add_root(struct rb_root *root_lookup,
618618
error_msg(ERROR_MSG_MEMORY, NULL);
619619
exit(1);
620620
}
621-
strncpy_null(ri->name, name, name_len);
621+
strncpy_null(ri->name, name, name_len + 1);
622622
}
623623
if (ref_tree)
624624
ri->ref_tree = ref_tree;

0 commit comments

Comments
 (0)