summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/tar/read_header.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/tar/read_header.c b/lib/tar/read_header.c
index 1f20334..e8e49c2 100644
--- a/lib/tar/read_header.c
+++ b/lib/tar/read_header.c
@@ -116,7 +116,8 @@ static int decode_header(const tar_header_t *hdr, unsigned int set_by_pax,
if (hdr->typeflag == TAR_TYPE_LINK ||
hdr->typeflag == TAR_TYPE_SLINK) {
if (!(set_by_pax & PAX_SLINK_TARGET)) {
- out->link_target = strdup(hdr->linkname);
+ out->link_target = strndup(hdr->linkname,
+ sizeof(hdr->linkname));
if (out->link_target == NULL) {
perror("decoding symlink target");
return -1;