From ee42fd20b08670803a294b3bf41c97792a1dce17 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sun, 30 Oct 2016 19:37:10 +0100 Subject: [PATCH] Cool buffer overflow, NTAuthority! --- src/Components/Modules/Materials.cpp | 2 +- src/Components/Modules/Zones.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Components/Modules/Materials.cpp b/src/Components/Modules/Materials.cpp index a3959d2b..4e65086e 100644 --- a/src/Components/Modules/Materials.cpp +++ b/src/Components/Modules/Materials.cpp @@ -102,7 +102,7 @@ namespace Components void Materials::DumpImageCfgPath(int, const char*, const char* material) { FILE* fp = nullptr; - if (!fopen_s(&fp, "dump.cfg", "a") && fp != nullptr) + if (!fopen_s(&fp, "dump.cfg", "a") && fp) { fprintf(fp, "dumpraw %s\n", material); fclose(fp); diff --git a/src/Components/Modules/Zones.cpp b/src/Components/Modules/Zones.cpp index a1be2529..ae644138 100644 --- a/src/Components/Modules/Zones.cpp +++ b/src/Components/Modules/Zones.cpp @@ -858,7 +858,7 @@ namespace Components { bool result = Game::Load_Stream(atStreamStart, buffer, 84); - static char tempVar[84]; + char tempVar[84] = { 0 }; std::memcpy(&tempVar[0], &buffer[0], 44); std::memcpy(&tempVar[56], &buffer[44], 28); std::memcpy(&tempVar[44], &buffer[72], 12); @@ -938,9 +938,9 @@ namespace Components { bool result = Game::Load_Stream(atStreamStart, buffer, 788); - static char tempVar[788]; + char tempVar[788] = { 0 }; std::memcpy(&tempVar[0], &buffer[0], 400); - std::memcpy(&tempVar[408], &buffer[400], 388); + std::memcpy(&tempVar[408], &buffer[400], 380); AssetHandler::Relocate(buffer + 400, buffer + 408, 388);