From 06f8beac29b074264b8ed112ae71c113489f1758 Mon Sep 17 00:00:00 2001 From: Greg Kaiser Date: Fri, 6 Apr 2018 16:35:02 -0700 Subject: find_java2: Fix array size calculation GetModuleFileName() takes the maximum number of TCHARs we can fit as the final argument, and thus we need to divide by sizeof(TCHAR), instead of multiplying by it. Test: Treehugger Change-Id: Icbbb04c29955075e9341a0153dbd750cce8e884b --- find_java2/src/utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/find_java2/src/utils.cpp b/find_java2/src/utils.cpp index 7f4aa02bc..7c8c66b67 100755 --- a/find_java2/src/utils.cpp +++ b/find_java2/src/utils.cpp @@ -219,7 +219,7 @@ int execWait(const TCHAR *cmd) { bool getModuleDir(CPath *outDir) { TCHAR programDir[MAX_PATH]; - int ret = GetModuleFileName(NULL, programDir, sizeof(programDir) * sizeof(TCHAR)); + int ret = GetModuleFileName(NULL, programDir, sizeof(programDir) / sizeof(programDir[0])); if (ret != 0) { CPath dir(programDir); dir.RemoveFileSpec(); -- cgit v1.2.3