From 19ef6988b63bafb6046614a35b570d4d5a43beee Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Thu, 17 Feb 2022 22:50:44 +0200 Subject: [PATCH] Utility: Fied possible stack buffer overrun in `ComputeFileHash2` --- ExplorerPatcher/utility.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ExplorerPatcher/utility.c b/ExplorerPatcher/utility.c index 3e8c741..5ce7b71 100644 --- a/ExplorerPatcher/utility.c +++ b/ExplorerPatcher/utility.c @@ -430,7 +430,7 @@ int ComputeFileHash2(HMODULE hModule, LPCWSTR filename, LPSTR hash, DWORD dwHash char real_hash[33]; ComputeFileHash(filename, real_hash, 33); - strncpy_s(hash + strlen(hash), dwHash, real_hash, 32 - strlen(hash)); + strncpy_s(hash + strlen(hash), dwHash - strlen(hash), real_hash, 32 - strlen(hash)); hash[33] = 0; return ERROR_SUCCESS;