https://git.reactos.org/?p=reactos.git;a=commitdiff;h=521d330d048af5df80b2ff...
commit 521d330d048af5df80b2ffdb268141f907de4844 Author: Jérôme Gardou jerome.gardou@reactos.org AuthorDate: Tue Jun 8 18:04:35 2021 +0200 Commit: Jérôme Gardou zefklop@users.noreply.github.com CommitDate: Wed Jun 9 11:23:39 2021 +0200
[CMD] Use GetFullPathName instead of copying buffers when resolving executable names
This properly strips spaces & dots at the end of the file.
Fixes the infinite loop with CreateProcess calling cmd over and over with e.g. 'cmd /c "some_script.bat "' Uncovered by recent ShellExecuteEx tests Dedicated to Katayama for the trigger & Hermès for the tests --- base/shell/cmd/where.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/base/shell/cmd/where.c b/base/shell/cmd/where.c index 0ba4c08c5ec..4030a877a73 100644 --- a/base/shell/cmd/where.c +++ b/base/shell/cmd/where.c @@ -106,7 +106,7 @@ SearchForExecutableSingle (LPCTSTR pFileName, LPTSTR pFullName, LPTSTR pPathExt, if (IsExistingFile (szPathBuffer)) { TRACE ("Found: '%s'\n", debugstr_aw(szPathBuffer)); - _tcscpy (pFullName, szPathBuffer); + GetFullPathName(szPathBuffer, MAX_PATH, pFullName, NULL); return TRUE; }
@@ -130,7 +130,7 @@ SearchForExecutableSingle (LPCTSTR pFileName, LPTSTR pFullName, LPTSTR pPathExt, if (IsExistingFile (szPathBuffer)) { TRACE ("Found: '%s'\n", debugstr_aw(szPathBuffer)); - _tcscpy (pFullName, szPathBuffer); + GetFullPathName(szPathBuffer, MAX_PATH, pFullName, NULL); return TRUE; } }