diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-02-23 12:34:58 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-02-23 12:34:58 (GMT) |
commit | c0f6db4b8165a139a30bd801ca3d8ffb56210940 (patch) | |
tree | 69331dc9814668ff6de2d71a0b61e87a09963427 /unix/tclUnixFile.c | |
parent | bdd6e3f4dfea4d7d47d323b51a660c7c7517a531 (diff) | |
download | tcl-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 'unix/tclUnixFile.c')
-rw-r--r-- | unix/tclUnixFile.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 3b09799..f2a6b23 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -43,9 +43,9 @@ TclpFindExecutable( #ifdef __CYGWIN__ int length; char buf[PATH_MAX * 2]; - char name[PATH_MAX * TCL_UTF_MAX + 1]; - GetModuleFileNameW(NULL, buf, PATH_MAX); - cygwin_conv_path(3, buf, name, PATH_MAX); + char name[PATH_MAX * 3 + 1]; + GetModuleFileNameW(NULL, buf, sizeof(buf)/2); + cygwin_conv_path(3, buf, name, sizeof(name)); length = strlen(name); if ((length > 4) && !strcasecmp(name + length - 4, ".exe")) { /* Strip '.exe' part. */ |