From ab2260355afb59c70f01f6f19befe88a228f044d Mon Sep 17 00:00:00 2001 From: David Sterba Date: Tue, 25 Jun 2024 16:02:45 +0200 Subject: [PATCH] btrfs-progs: subvol list: fix accidental trimming of subvolume name Commit 4db925911c6bbb ("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 --- cmds/subvolume-list.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmds/subvolume-list.c b/cmds/subvolume-list.c index 52a30aa0..24e5c685 100644 --- a/cmds/subvolume-list.c +++ b/cmds/subvolume-list.c @@ -547,7 +547,7 @@ static int update_root(struct rb_root *root_lookup, error_msg(ERROR_MSG_MEMORY, NULL); exit(1); } - strncpy_null(ri->name, name, name_len); + strncpy_null(ri->name, name, name_len + 1); } if (ref_tree) ri->ref_tree = ref_tree; @@ -618,7 +618,7 @@ static int add_root(struct rb_root *root_lookup, error_msg(ERROR_MSG_MEMORY, NULL); exit(1); } - strncpy_null(ri->name, name, name_len); + strncpy_null(ri->name, name, name_len + 1); } if (ref_tree) ri->ref_tree = ref_tree;