From 25a1061700415601236977eeacf458dbb18ea5e2 Mon Sep 17 00:00:00 2001 From: Tixx <83774803+WiserTixx@users.noreply.github.com> Date: Thu, 1 May 2025 20:42:01 +0200 Subject: [PATCH 1/3] Verify mod hash after downloading --- src/Network/Resources.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Network/Resources.cpp b/src/Network/Resources.cpp index 99c75b3..316c426 100644 --- a/src/Network/Resources.cpp +++ b/src/Network/Resources.cpp @@ -571,11 +571,16 @@ void NewSyncResources(SOCKET Sock, const std::string& Mods, const std::vectorHash) { + error("Failed to write or download the entire file '" + PathToSaveTo + "' correctly (hash mismatch)"); + Terminate = true; + } } while (fs::file_size(PathToSaveTo) != ModInfoIter->FileSize && !Terminate); if (!Terminate) { if (!fs::exists(GetGamePath() + "mods/multiplayer")) { From 4de0bc9a40b01d1804a05b5231672d33ebc9f358 Mon Sep 17 00:00:00 2001 From: Tixx <83774803+WiserTixx@users.noreply.github.com> Date: Thu, 1 May 2025 20:47:16 +0200 Subject: [PATCH 2/3] Check download confirmation packet --- src/Network/Resources.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Network/Resources.cpp b/src/Network/Resources.cpp index 316c426..dda266b 100644 --- a/src/Network/Resources.cpp +++ b/src/Network/Resources.cpp @@ -557,6 +557,12 @@ void NewSyncResources(SOCKET Sock, const std::string& Mods, const std::vector DownloadedFile = SingleNormalDownload(Sock, ModInfoIter->FileSize, Name); From d3263aceaddf5c6f8bd7885184d918213d6ceeab Mon Sep 17 00:00:00 2001 From: Tixx <83774803+WiserTixx@users.noreply.github.com> Date: Thu, 1 May 2025 20:54:28 +0200 Subject: [PATCH 3/3] Log corrupted download confirmation --- src/Network/Resources.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Network/Resources.cpp b/src/Network/Resources.cpp index dda266b..d4f3142 100644 --- a/src/Network/Resources.cpp +++ b/src/Network/Resources.cpp @@ -559,6 +559,7 @@ void NewSyncResources(SOCKET Sock, const std::string& Mods, const std::vector