From 02d6107c97b48888362e7c6a70dcac323c89d741 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sun, 17 Dec 2023 21:23:58 +0100 Subject: ZipArchive: Update to the 4.6.9 release --- zip/ZipArchive/ZipCrc32Cryptograph.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'zip/ZipArchive/ZipCrc32Cryptograph.cpp') diff --git a/zip/ZipArchive/ZipCrc32Cryptograph.cpp b/zip/ZipArchive/ZipCrc32Cryptograph.cpp index 50a0e2b..8994e44 100644 --- a/zip/ZipArchive/ZipCrc32Cryptograph.cpp +++ b/zip/ZipArchive/ZipCrc32Cryptograph.cpp @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////// -// This source file is part of the ZipArchive library source distribution and -// is Copyrighted 2000 - 2007 by Artpol Software - Tadeusz Dracz +// This source file is part of the ZipArchive Library Open Source distribution +// and is Copyrighted 2000 - 2022 by Artpol Software - Tadeusz Dracz // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -9,13 +9,13 @@ // // For the licensing details refer to the License.txt file. // -// Web Site: http://www.artpol-software.com +// Web Site: https://www.artpol-software.com //////////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "ZipCrc32Cryptograph.h" -bool CZipCrc32Cryptograph::InitDecode(CZipAutoBuffer& password, CZipFileHeader& currentFile, CZipStorage& storage) +bool CZipCrc32Cryptograph::InitDecode(CZipAutoBuffer& password, CZipFileHeader& currentFile, CZipStorage& storage, bool ignoreCheck) { CryptInitKeys(password); CZipAutoBuffer buf(ZIPARCHIVE_ENCR_HEADER_LEN); @@ -27,8 +27,8 @@ bool CZipCrc32Cryptograph::InitDecode(CZipAutoBuffer& password, CZipFileHeader& CryptDecode((char&)b); } // check the last byte - return currentFile.IsDataDescriptor() ? - (BYTE(currentFile.m_uModTime >> 8) == b) : (BYTE(currentFile.m_uCrc32 >> 24) == b); + return ignoreCheck || (currentFile.IsDataDescriptor() ? + (BYTE(currentFile.m_uModTime >> 8) == b) : (BYTE(currentFile.m_uCrc32 >> 24) == b)); } void CZipCrc32Cryptograph::InitEncode(CZipAutoBuffer& password, CZipFileHeader& currentFile, CZipStorage& storage) @@ -37,7 +37,7 @@ void CZipCrc32Cryptograph::InitEncode(CZipAutoBuffer& password, CZipFileHeader& // use pseudo-crc since we don't know it yet CryptInitKeys(password); srand(UINT(time(NULL))); - // genereate pseudo-random sequence + // generate pseudo-random sequence char c; char* buffer = (char*)buf; for (int i = 0; i < ZIPARCHIVE_ENCR_HEADER_LEN - 2; i++) @@ -50,7 +50,7 @@ void CZipCrc32Cryptograph::InitEncode(CZipAutoBuffer& password, CZipFileHeader& buffer[i] = c; } - long iCrc = (long)currentFile.m_uModTime << 16; + int iCrc = (int)currentFile.m_uModTime << 16; c = (char)((iCrc >> 16) & 0xFF); CryptEncode(c); buffer[ZIPARCHIVE_ENCR_HEADER_LEN - 2] = c; -- cgit v1.2.3