btrfs-progs: subvol list: fix accidental trimming of subvolume name

Commit 4db925911c ("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>
This commit is contained in:
David Sterba 2024-06-25 16:02:45 +02:00
parent 712f009f6f
commit ab2260355a
1 changed files with 2 additions and 2 deletions

View File

@ -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;