diff --git a/code/nel/src/misc/streamed_package_manager.cpp b/code/nel/src/misc/streamed_package_manager.cpp index 8114da948..89e5724c3 100644 --- a/code/nel/src/misc/streamed_package_manager.cpp +++ b/code/nel/src/misc/streamed_package_manager.cpp @@ -27,6 +27,7 @@ #include #include #include +#include namespace NLMISC { @@ -242,6 +243,15 @@ bool CStreamedPackageManager::getFile(std::string &filePath, const std::string & } } + CHashKey outHash = outBuffer.size() ? getSHA1(&outBuffer[0], outBuffer.size()) : CHashKey(); + if (!(outHash == entry->Hash)) + { + std::string wantHashS = entry->Hash.toString(); + std::string outHashS = outHash.toString(); + nlwarning("Invalid SHA1 hash for file '%s', download has hash '%s'", wantHashS.c_str(), outHashS.c_str()); + return false; + } + { COFile outStream(unpackPath); outStream.serialBuffer(&outBuffer[0], (uint)fileSize);