aboutsummaryrefslogtreecommitdiff
path: root/bfd/archive.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/archive.c')
-rw-r--r--bfd/archive.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/archive.c b/bfd/archive.c
index 090c141..a968dd5 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -1412,7 +1412,9 @@ bfd_dont_truncate_arname (abfd, pathname, arhdr)
if (length <= maxlen)
memcpy (hdr->ar_name, filename, length);
- if (length < maxlen)
+ /* Add the padding character if there is room for it. */
+ if (length < maxlen
+ || (length == maxlen && length < sizeof hdr->ar_name))
(hdr->ar_name)[length] = ar_padchar (abfd);
}