aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Archive/ArchiveReader.cpp3
-rw-r--r--test/Archive/MacOSX.tocbin97 -> 72 bytes
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp
index a0c42b5016..3ef15d25d6 100644
--- a/lib/Archive/ArchiveReader.cpp
+++ b/lib/Archive/ArchiveReader.cpp
@@ -120,7 +120,8 @@ Archive::parseMemberHeader(const char*& At, const char* End, std::string* error)
if (Hdr->name[1] == '1' && Hdr->name[2] == '/') {
if (isdigit(Hdr->name[3])) {
unsigned len = atoi(&Hdr->name[3]);
- pathname.assign(At, len);
+ const char *nulp = (const char *)memchr(At, '\0', len);
+ pathname.assign(At, nulp != 0 ? nulp - At : len);
At += len;
MemberSize -= len;
flags |= ArchiveMember::HasLongFilenameFlag;
diff --git a/test/Archive/MacOSX.toc b/test/Archive/MacOSX.toc
index 61cbd3b2a0..f971df7332 100644
--- a/test/Archive/MacOSX.toc
+++ b/test/Archive/MacOSX.toc
Binary files differ