btrfs-progs: convert: copy whole xattr name buffer

Commit 4db925911c ("btrfs-progs: use strncpy_null everywhere")
replaced strncpy with strncpy_null, the maximum xattr name length is 255
(current limit), the target buffer is large enough for the whole size so
make sure the last character is also copied.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2024-06-25 17:03:36 +02:00
parent ab2260355a
commit ed1c6b8c00
1 changed files with 1 additions and 1 deletions

View File

@ -639,7 +639,7 @@ static int ext2_copy_single_xattr(struct btrfs_trans_handle *trans,
data = databuf; data = databuf;
datalen = bufsize; datalen = bufsize;
} }
strncpy_null(namebuf, xattr_prefix_table[name_index], XATTR_NAME_MAX); strncpy_null(namebuf, xattr_prefix_table[name_index], XATTR_NAME_MAX + 1);
strncat(namebuf, EXT2_EXT_ATTR_NAME(entry), entry->e_name_len); strncat(namebuf, EXT2_EXT_ATTR_NAME(entry), entry->e_name_len);
if (name_len + datalen > BTRFS_LEAF_DATA_SIZE(root->fs_info) - if (name_len + datalen > BTRFS_LEAF_DATA_SIZE(root->fs_info) -
sizeof(struct btrfs_item) - sizeof(struct btrfs_dir_item)) { sizeof(struct btrfs_item) - sizeof(struct btrfs_dir_item)) {