https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c5e6e5a19c38795162992b3403542d3d67e4c38a

commit c5e6e5a19c38795162992b3403542d3d67e4c38a
Author:     Hermès Bélusca-Maïto <[email protected]>
AuthorDate: Sun Jul 12 17:53:20 2020 +0200
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Wed Aug 19 20:36:01 2020 +0200

    [CMD] GOTO: Fix handling of the ':EOF' label handling.
    
    - The ':EOF' label feature is available only when extensions are enabled.
    
    - Anything that follows the ':EOF' label, separated by at least one
      whitespace character, is ignored, and the batch file terminates.
---
 base/shell/cmd/goto.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/base/shell/cmd/goto.c b/base/shell/cmd/goto.c
index 585a9708072..5831b25e22f 100644
--- a/base/shell/cmd/goto.c
+++ b/base/shell/cmd/goto.c
@@ -65,8 +65,10 @@ INT cmd_goto(LPTSTR param)
         ++tmp;
     *tmp = _T('\0');
 
-    /* jump to end of the file */
-    if ( _tcsicmp( param, _T(":eof"))==0)
+    /* Support jumping to the end of the file, only if extensions are enabled 
*/
+    if (bEnableExtensions &&
+        (_tcsnicmp(param, _T(":EOF"), 4) == 0) &&
+        (!param[4] || _istspace(param[4])))
     {
         /* Position at the end of the batch file */
         bc->mempos = bc->memsize;

Reply via email to