Skip to content

Commit 0e87782

Browse files
dinhngtuMouriNaruto
authored andcommitted
Apply the $DATA match suppression to Core/Universal
Signed-off-by: Tu Dinh <contact@tudinh.xyz>
1 parent ec9f1e4 commit 0e87782

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎NanaZip.Core/SevenZip/CPP/7zip/UI/Common/ExtractingFilePath.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,20 @@ static void ReplaceIncorrectChars(UString &s)
9696
void Correct_AltStream_Name(UString &s)
9797
{
9898
unsigned len = s.Len();
99+
// **************** NanaZip Modification Start ****************
100+
// ":$DATA" match suppressed in NanaZip because of security risk.
101+
// For example, ":Zone.Identifier:$DATA" can be used to bypass rejection of
102+
// Zone.Identifier streams embedded in the archive.
103+
#if 0 // ******** Annotated 7-Zip Mainline Source Code snippet Start ********
99104
const unsigned kPostfixSize = 6;
100105
if (s.Len() >= kPostfixSize
101106
&& StringsAreEqualNoCase_Ascii(s.RightPtr(kPostfixSize), ":$DATA"))
102107
{
103108
len -= kPostfixSize;
104109
s.DeleteFrom(len);
105110
}
111+
#endif // ******** Annotated 7-Zip Mainline Source Code snippet End ********
112+
// **************** NanaZip Modification End ****************
106113
for (unsigned i = 0; i < len; i++)
107114
{
108115
const wchar_t c = s[i];

‎NanaZip.Universal/SevenZip/CPP/7zip/UI/Common/ExtractingFilePath.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,20 @@ static void ReplaceIncorrectChars(UString &s)
9696
void Correct_AltStream_Name(UString &s)
9797
{
9898
unsigned len = s.Len();
99+
// **************** NanaZip Modification Start ****************
100+
// ":$DATA" match suppressed in NanaZip because of security risk.
101+
// For example, ":Zone.Identifier:$DATA" can be used to bypass rejection of
102+
// Zone.Identifier streams embedded in the archive.
103+
#if 0 // ******** Annotated 7-Zip Mainline Source Code snippet Start ********
99104
const unsigned kPostfixSize = 6;
100105
if (s.Len() >= kPostfixSize
101106
&& StringsAreEqualNoCase_Ascii(s.RightPtr(kPostfixSize), ":$DATA"))
102107
{
103108
len -= kPostfixSize;
104109
s.DeleteFrom(len);
105110
}
111+
#endif // ******** Annotated 7-Zip Mainline Source Code snippet End ********
112+
// **************** NanaZip Modification End ****************
106113
for (unsigned i = 0; i < len; i++)
107114
{
108115
const wchar_t c = s[i];

0 commit comments

Comments
 (0)