diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-03-10 22:50:59 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-03-10 23:13:02 +0100 |
commit | 6a19a4f5a755ebde63d7aa3d020460aea58e7ac8 (patch) | |
tree | d6ecb28af714ec2aafc6b206bb1eda43c3a2f3ca /lib | |
parent | 1c6b8dbe89d061f37a5f1e917e02128a5dd03c59 (diff) |
Cleanup libtar mkxattr, explicitly null-terminate strings
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tar/pax_header.c | 8 |
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; } |