Skip to content

Commit 322929e

Browse files
committed
btrfs-progs: convert: copy whole xattr name buffer
Commit 4db9259 ("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>
1 parent 061e156 commit 322929e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

convert/source-ext2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ static int ext2_copy_single_xattr(struct btrfs_trans_handle *trans,
639639
data = databuf;
640640
datalen = bufsize;
641641
}
642-
strncpy_null(namebuf, xattr_prefix_table[name_index], XATTR_NAME_MAX);
642+
strncpy_null(namebuf, xattr_prefix_table[name_index], XATTR_NAME_MAX + 1);
643643
strncat(namebuf, EXT2_EXT_ATTR_NAME(entry), entry->e_name_len);
644644
if (name_len + datalen > BTRFS_LEAF_DATA_SIZE(root->fs_info) -
645645
sizeof(struct btrfs_item) - sizeof(struct btrfs_dir_item)) {

0 commit comments

Comments
 (0)