Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/7zip/Archive/Tar/TarIn.cpp')
-rwxr-xr-xCPP/7zip/Archive/Tar/TarIn.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/CPP/7zip/Archive/Tar/TarIn.cpp b/CPP/7zip/Archive/Tar/TarIn.cpp
index b8409195..939c6c0a 100755
--- a/CPP/7zip/Archive/Tar/TarIn.cpp
+++ b/CPP/7zip/Archive/Tar/TarIn.cpp
@@ -69,11 +69,20 @@ static HRESULT GetNextItemReal(ISequentialInStream *stream, bool &filled, CItemE
filled = false;
- processedSize = NFileHeader::kRecordSize;
- RINOK(ReadStream(stream, buf, &processedSize));
- if (processedSize == 0 || (processedSize == NFileHeader::kRecordSize && IsRecordLast(buf)))
- return S_OK;
- if (processedSize < NFileHeader::kRecordSize)
+ bool thereAreEmptyRecords = false;
+ for (;;)
+ {
+ processedSize = NFileHeader::kRecordSize;
+ RINOK(ReadStream(stream, buf, &processedSize));
+ if (processedSize == 0)
+ return S_OK;
+ if (processedSize != NFileHeader::kRecordSize)
+ return S_FALSE;
+ if (!IsRecordLast(buf))
+ break;
+ thereAreEmptyRecords = true;
+ }
+ if (thereAreEmptyRecords)
return S_FALSE;
ReadString(p, NFileHeader::kNameSize, item.Name); p += NFileHeader::kNameSize;