From d0c26df032744c552d10bc10156ba916fac07af5 Mon Sep 17 00:00:00 2001 From: Alastair Houghton Date: Wed, 1 Jan 2020 16:30:08 +0000 Subject: [PATCH] Fixed a buffer allocation bug. --- src/ArgxFindExecutable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ArgxFindExecutable.cpp b/src/ArgxFindExecutable.cpp index 01ae007..558b84f 100644 --- a/src/ArgxFindExecutable.cpp +++ b/src/ArgxFindExecutable.cpp @@ -177,7 +177,7 @@ ArgxFindExecutableW(LPCWSTR lpszArgv0) // If it has a path, return a copy of the string as-is if (hasPath) { - LPWSTR pszResult = (LPWSTR)LocalAlloc(LMEM_FIXED, len + 1); + LPWSTR pszResult = (LPWSTR)LocalAlloc(LMEM_FIXED, (len + 1) * sizeof(WCHAR)); CopyMemory(pszResult, lpszArgv0, (len + 1) * sizeof(WCHAR)); return pszResult; }