Added the correct p7zip-15.09-CVE-2015-1038.patch

i9fe
Sérgio M. Basto 9 years ago
parent 212716b55d
commit 578cf139e9

@ -21,9 +21,10 @@ still exists and is the same inode. XXX It also checks 'birth time' but
this isn't portable. We can probably get away with comparing ctime this isn't portable. We can probably get away with comparing ctime
since we don't support hard links. since we don't support hard links.
--- a/CPP/7zip/UI/Agent/Agent.cpp diff -rup p7zip_15.09.orig/CPP/7zip/UI/Agent/Agent.cpp p7zip_15.09/CPP/7zip/UI/Agent/Agent.cpp
+++ b/CPP/7zip/UI/Agent/Agent.cpp --- p7zip_15.09.orig/CPP/7zip/UI/Agent/Agent.cpp 2015-09-17 20:02:35.000000000 +0100
@@ -1215,7 +1215,7 @@ STDMETHODIMP CAgentFolder::Extract(const +++ p7zip_15.09/CPP/7zip/UI/Agent/Agent.cpp 2015-12-03 02:22:47.073724194 +0000
@@ -1515,7 +1515,7 @@ STDMETHODIMP CAgentFolder::Extract(const
HRESULT result = _agentSpec->GetArchive()->Extract(&realIndices.Front(), HRESULT result = _agentSpec->GetArchive()->Extract(&realIndices.Front(),
realIndices.Size(), testMode, extractCallback); realIndices.Size(), testMode, extractCallback);
if (result == S_OK) if (result == S_OK)
@ -32,9 +33,10 @@ since we don't support hard links.
return result; return result;
COM_TRY_END COM_TRY_END
} }
--- a/CPP/7zip/UI/Client7z/Client7z.cpp diff -rup p7zip_15.09.orig/CPP/7zip/UI/Client7z/Client7z.cpp p7zip_15.09/CPP/7zip/UI/Client7z/Client7z.cpp
+++ b/CPP/7zip/UI/Client7z/Client7z.cpp --- p7zip_15.09.orig/CPP/7zip/UI/Client7z/Client7z.cpp 2015-10-17 15:52:30.000000000 +0100
@@ -222,8 +222,11 @@ private: +++ p7zip_15.09/CPP/7zip/UI/Client7z/Client7z.cpp 2015-12-03 02:22:47.073724194 +0000
@@ -230,8 +230,11 @@ private:
COutFileStream *_outFileStreamSpec; COutFileStream *_outFileStreamSpec;
CMyComPtr<ISequentialOutStream> _outFileStream; CMyComPtr<ISequentialOutStream> _outFileStream;
@ -46,7 +48,7 @@ since we don't support hard links.
UInt64 NumErrors; UInt64 NumErrors;
bool PasswordIsDefined; bool PasswordIsDefined;
@@ -441,11 +444,23 @@ STDMETHODIMP CArchiveExtractCallback::Se @@ -449,11 +452,23 @@ STDMETHODIMP CArchiveExtractCallback::Se
} }
_outFileStream.Release(); _outFileStream.Release();
if (_extractMode && _processedFileInfo.AttribDefined) if (_extractMode && _processedFileInfo.AttribDefined)
@ -71,7 +73,7 @@ since we don't support hard links.
STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password) STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
{ {
@@ -912,6 +927,8 @@ int MY_CDECL main(int numArgs, const cha @@ -914,6 +929,8 @@ int MY_CDECL main(int numArgs, const cha
// extractCallbackSpec->PasswordIsDefined = true; // extractCallbackSpec->PasswordIsDefined = true;
// extractCallbackSpec->Password = L"1"; // extractCallbackSpec->Password = L"1";
HRESULT result = archive->Extract(NULL, (UInt32)(Int32)(-1), false, extractCallback); HRESULT result = archive->Extract(NULL, (UInt32)(Int32)(-1), false, extractCallback);
@ -80,18 +82,19 @@ since we don't support hard links.
if (result != S_OK) if (result != S_OK)
{ {
PrintError("Extract Error"); PrintError("Extract Error");
--- a/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp diff -rup p7zip_15.09.orig/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp p7zip_15.09/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
+++ b/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp --- p7zip_15.09.orig/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp 2015-10-03 09:49:15.000000000 +0100
@@ -1083,7 +1083,7 @@ STDMETHODIMP CArchiveExtractCallback::Se +++ p7zip_15.09/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp 2015-12-03 02:24:40.444963545 +0000
@@ -1502,7 +1502,7 @@ STDMETHODIMP CArchiveExtractCallback::Se
NumFiles++; NumFiles++;
if (_extractMode && _fi.AttribDefined) if (!_stdOutMode && _extractMode && _fi.AttribDefined)
- SetFileAttrib(_diskFilePath, _fi.Attrib); - SetFileAttrib(_diskFilePath, _fi.Attrib);
+ SetFileAttrib(_diskFilePath, _fi.Attrib, &_delayedSymLinks); + SetFileAttrib(_diskFilePath, _fi.Attrib, &_delayedSymLinks);
RINOK(_extractCallback2->SetOperationResult(operationResult, _encrypted));
return S_OK; RINOK(_extractCallback2->SetOperationResult(opRes, BoolToInt(_encrypted)));
COM_TRY_END
@@ -1149,8 +1149,9 @@ static int GetNumSlashes(const FChar *s) @@ -1584,8 +1584,9 @@ static unsigned GetNumSlashes(const FCha
} }
} }
@ -102,7 +105,7 @@ since we don't support hard links.
CRecordVector<CExtrRefSortPair> pairs; CRecordVector<CExtrRefSortPair> pairs;
pairs.ClearAndSetSize(_extractedFolderPaths.Size()); pairs.ClearAndSetSize(_extractedFolderPaths.Size());
unsigned i; unsigned i;
@@ -1187,5 +1188,12 @@ HRESULT CArchiveExtractCallback::SetDirs @@ -1622,5 +1623,12 @@ HRESULT CArchiveExtractCallback::SetDirs
(WriteATime && ATimeDefined) ? &ATime : NULL, (WriteATime && ATimeDefined) ? &ATime : NULL,
(WriteMTime && MTimeDefined) ? &MTime : (_arc->MTimeDefined ? &_arc->MTime : NULL)); (WriteMTime && MTimeDefined) ? &MTime : (_arc->MTimeDefined ? &_arc->MTime : NULL));
} }
@ -116,8 +119,9 @@ since we don't support hard links.
+ +
+ return result; + return result;
} }
--- a/CPP/7zip/UI/Common/ArchiveExtractCallback.h diff -rup p7zip_15.09.orig/CPP/7zip/UI/Common/ArchiveExtractCallback.h p7zip_15.09/CPP/7zip/UI/Common/ArchiveExtractCallback.h
+++ b/CPP/7zip/UI/Common/ArchiveExtractCallback.h --- p7zip_15.09.orig/CPP/7zip/UI/Common/ArchiveExtractCallback.h 2015-10-03 11:29:09.000000000 +0100
+++ p7zip_15.09/CPP/7zip/UI/Common/ArchiveExtractCallback.h 2015-12-03 02:22:47.074724204 +0000
@@ -6,6 +6,8 @@ @@ -6,6 +6,8 @@
#include "../../../Common/MyCom.h" #include "../../../Common/MyCom.h"
#include "../../../Common/Wildcard.h" #include "../../../Common/Wildcard.h"
@ -127,7 +131,7 @@ since we don't support hard links.
#include "../../IPassword.h" #include "../../IPassword.h"
#include "../../Common/FileStreams.h" #include "../../Common/FileStreams.h"
@@ -213,6 +215,8 @@ class CArchiveExtractCallback: @@ -237,6 +239,8 @@ class CArchiveExtractCallback:
bool _saclEnabled; bool _saclEnabled;
#endif #endif
@ -136,18 +140,19 @@ since we don't support hard links.
void CreateComplexDirectory(const UStringVector &dirPathParts, FString &fullPath); void CreateComplexDirectory(const UStringVector &dirPathParts, FString &fullPath);
HRESULT GetTime(int index, PROPID propID, FILETIME &filetime, bool &filetimeIsDefined); HRESULT GetTime(int index, PROPID propID, FILETIME &filetime, bool &filetimeIsDefined);
HRESULT GetUnpackSize(); HRESULT GetUnpackSize();
@@ -293,7 +297,7 @@ public: @@ -330,7 +334,7 @@ public:
_baseParentFolder = indexInArc;
} }
#endif
- HRESULT SetDirsTimes(); - HRESULT SetDirsTimes();
+ HRESULT SetFinalAttribs(); + HRESULT SetFinalAttribs();
}; };
#endif bool CensorNode_CheckPath(const NWildcard::CCensorNode &node, const CReadArcItem &item);
--- a/CPP/7zip/UI/Common/Extract.cpp diff -rup p7zip_15.09.orig/CPP/7zip/UI/Common/Extract.cpp p7zip_15.09/CPP/7zip/UI/Common/Extract.cpp
+++ b/CPP/7zip/UI/Common/Extract.cpp --- p7zip_15.09.orig/CPP/7zip/UI/Common/Extract.cpp 2015-09-07 20:47:32.000000000 +0100
@@ -170,7 +170,7 @@ static HRESULT DecompressArchive( +++ p7zip_15.09/CPP/7zip/UI/Common/Extract.cpp 2015-12-03 02:22:47.075724215 +0000
@@ -207,7 +207,7 @@ static HRESULT DecompressArchive(
else else
result = archive->Extract(&realIndices.Front(), realIndices.Size(), testMode, ecs); result = archive->Extract(&realIndices.Front(), realIndices.Size(), testMode, ecs);
if (result == S_OK && !options.StdInMode) if (result == S_OK && !options.StdInMode)
@ -156,9 +161,10 @@ since we don't support hard links.
return callback->ExtractResult(result); return callback->ExtractResult(result);
} }
--- a/CPP/Windows/FileDir.cpp diff -rup p7zip_15.09.orig/CPP/Windows/FileDir.cpp p7zip_15.09/CPP/Windows/FileDir.cpp
+++ b/CPP/Windows/FileDir.cpp --- p7zip_15.09.orig/CPP/Windows/FileDir.cpp 2015-10-10 13:37:41.000000000 +0100
@@ -343,7 +343,8 @@ static int convert_to_symlink(const char +++ p7zip_15.09/CPP/Windows/FileDir.cpp 2015-12-03 02:22:47.075724215 +0000
@@ -347,7 +347,8 @@ static int convert_to_symlink(const char
return -1; return -1;
} }
@ -168,7 +174,7 @@ since we don't support hard links.
{ {
if (!fileName) { if (!fileName) {
SetLastError(ERROR_PATH_NOT_FOUND); SetLastError(ERROR_PATH_NOT_FOUND);
@@ -375,7 +376,9 @@ bool SetFileAttrib(CFSTR fileName, DWORD @@ -379,7 +380,9 @@ bool SetFileAttrib(CFSTR fileName, DWORD
stat_info.st_mode = fileAttributes >> 16; stat_info.st_mode = fileAttributes >> 16;
#ifdef ENV_HAVE_LSTAT #ifdef ENV_HAVE_LSTAT
if (S_ISLNK(stat_info.st_mode)) { if (S_ISLNK(stat_info.st_mode)) {
@ -179,7 +185,7 @@ since we don't support hard links.
TRACEN((printf("SetFileAttrib(%s,%d) : false-3\n",(const char *)name,fileAttributes))) TRACEN((printf("SetFileAttrib(%s,%d) : false-3\n",(const char *)name,fileAttributes)))
return false; return false;
} }
@@ -885,6 +888,43 @@ bool CTempDir::Remove() @@ -814,6 +817,43 @@ bool CTempDir::Remove()
return !_mustBeDeleted; return !_mustBeDeleted;
} }
@ -222,9 +228,10 @@ since we don't support hard links.
+ +
}}} }}}
#ifndef _SFX
--- a/CPP/Windows/FileDir.h diff -rup p7zip_15.09.orig/CPP/Windows/FileDir.h p7zip_15.09/CPP/Windows/FileDir.h
+++ b/CPP/Windows/FileDir.h --- p7zip_15.09.orig/CPP/Windows/FileDir.h 2015-06-19 11:52:06.000000000 +0100
+++ p7zip_15.09/CPP/Windows/FileDir.h 2015-12-03 02:22:47.075724215 +0000
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
#define __WINDOWS_FILE_DIR_H #define __WINDOWS_FILE_DIR_H
@ -249,7 +256,7 @@ since we don't support hard links.
bool MyMoveFile(CFSTR existFileName, CFSTR newFileName); bool MyMoveFile(CFSTR existFileName, CFSTR newFileName);
#ifndef UNDER_CE #ifndef UNDER_CE
@@ -69,6 +73,31 @@ public: @@ -76,6 +80,31 @@ public:
bool Remove(); bool Remove();
}; };
Loading…
Cancel
Save