aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-03-10 22:50:59 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-03-10 23:13:02 +0100
commit6a19a4f5a755ebde63d7aa3d020460aea58e7ac8 (patch)
treed6ecb28af714ec2aafc6b206bb1eda43c3a2f3ca
parent1c6b8dbe89d061f37a5f1e917e02128a5dd03c59 (diff)
Cleanup libtar mkxattr, explicitly null-terminate strings
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--lib/tar/pax_header.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/tar/pax_header.c b/lib/tar/pax_header.c
index a96a32f..95fb447 100644
--- a/lib/tar/pax_header.c
+++ b/lib/tar/pax_header.c
@@ -18,10 +18,14 @@ static tar_xattr_t *mkxattr(const char *key, size_t keylen,
return NULL;
xattr->key = xattr->data;
- xattr->value = (sqfs_u8 *)xattr->data + keylen + 1;
- xattr->value_len = valuelen;
memcpy(xattr->key, key, keylen);
+ xattr->key[keylen] = '\0';
+
+ xattr->value = (sqfs_u8 *)xattr->key + keylen + 1;
memcpy(xattr->value, value, valuelen);
+ xattr->value[valuelen] = '\0';
+
+ xattr->value_len = valuelen;
return xattr;
}