From 262fc48eb9e246ddb7315f5a14e7f6f58ca987c1 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 13 Dec 2019 15:47:35 +0100 Subject: Better support for reading/writing non-ASCII xattr values from/to tar Signed-off-by: David Oberhollenzer --- tar/sqfs2tar.c | 3 ++- tar/tar2sqfs.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'tar') diff --git a/tar/sqfs2tar.c b/tar/sqfs2tar.c index 6767b95..58fb611 100644 --- a/tar/sqfs2tar.c +++ b/tar/sqfs2tar.c @@ -267,9 +267,10 @@ static int get_xattrs(const char *name, const sqfs_inode_generic_t *inode, ent->key = ent->data; strcpy(ent->key, (const char *)key->key); - ent->value = ent->key + strlen(ent->key) + 1; + ent->value = (sqfs_u8 *)ent->key + strlen(ent->key) + 1; memcpy(ent->value, value->value, value->size + 1); + ent->value_len = value->size; ent->next = list; list = ent; diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c index 5d40fc5..6be682f 100644 --- a/tar/tar2sqfs.c +++ b/tar/tar2sqfs.c @@ -334,7 +334,7 @@ static int copy_xattr(tree_node_t *node, const tar_header_decoded_t *hdr) } ret = sqfs_xattr_writer_add(sqfs.xwr, xattr->key, xattr->value, - strlen(xattr->value)); + xattr->value_len); if (ret) { sqfs_perror(hdr->name, "storing xattr key-value pair", ret); -- cgit v1.2.3