summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-02-23 12:34:58 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-02-23 12:34:58 (GMT)
commitc0f6db4b8165a139a30bd801ca3d8ffb56210940 (patch)
tree69331dc9814668ff6de2d71a0b61e87a09963427 /win
parentbdd6e3f4dfea4d7d47d323b51a660c7c7517a531 (diff)
downloadtcl-c0f6db4b8165a139a30bd801ca3d8ffb56210940.zip
tcl-c0f6db4b8165a139a30bd801ca3d8ffb56210940.tar.gz
tcl-c0f6db4b8165a139a30bd801ca3d8ffb56210940.tar.bz2
Revise buffer-sizes used in GetModuleFileNameW() calls. Available buffer-size reported to GetModuleFileNameW() was not always accurate
Diffstat (limited to 'win')
-rw-r--r--win/tclWinFile.c2
-rw-r--r--win/tclWinInit.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index d582664..8df346f 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -852,7 +852,7 @@ TclpFindExecutable(
* create this process.
*/
- if (GetModuleFileNameW(NULL, wName, MAX_PATH) == 0) {
+ if (GetModuleFileNameW(NULL, wName, sizeof(wName)/sizeof(WCHAR)) == 0) {
GetModuleFileNameA(NULL, name, sizeof(name));
/*
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index 6c34573..2abcd3e 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -342,11 +342,11 @@ InitializeDefaultLibraryDir(
{
HMODULE hModule = TclWinGetTclInstance();
WCHAR wName[MAX_PATH + LIBRARY_SIZE];
- char name[(MAX_PATH + LIBRARY_SIZE) * TCL_UTF_MAX];
+ char name[(MAX_PATH + LIBRARY_SIZE) * 3];
char *end, *p;
- if (GetModuleFileNameW(hModule, wName, MAX_PATH) == 0) {
- GetModuleFileNameA(hModule, name, MAX_PATH);
+ if (GetModuleFileNameW(hModule, wName, sizeof(wName)/sizeof(WCHAR)) == 0) {
+ GetModuleFileNameA(hModule, name, sizeof(name));
} else {
ToUtf(wName, name);
}
@@ -393,11 +393,11 @@ InitializeSourceLibraryDir(
{
HMODULE hModule = TclWinGetTclInstance();
WCHAR wName[MAX_PATH + LIBRARY_SIZE];
- char name[(MAX_PATH + LIBRARY_SIZE) * TCL_UTF_MAX];
+ char name[(MAX_PATH + LIBRARY_SIZE) * 3];
char *end, *p;
- if (GetModuleFileNameW(hModule, wName, MAX_PATH) == 0) {
- GetModuleFileNameA(hModule, name, MAX_PATH);
+ if (GetModuleFileNameW(hModule, wName, sizeof(wName)/sizeof(WCHAR)) == 0) {
+ GetModuleFileNameA(hModule, name, sizeof(name));
} else {
ToUtf(wName, name);
}