Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
c418771a
Commit
c418771a
authored
Feb 09, 2024
by
Bernhard Übelacker
Committed by
Alexandre Julliard
Feb 12, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: Avoid execution if block misses closing brackets.
parent
d7edf3e6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
0 deletions
+36
-0
test_builtins.cmd
programs/cmd/tests/test_builtins.cmd
+24
-0
test_builtins.cmd.exp
programs/cmd/tests/test_builtins.cmd.exp
+5
-0
wcmdmain.c
programs/cmd/wcmdmain.c
+7
-0
No files found.
programs/cmd/tests/test_builtins.cmd
View file @
c418771a
...
...
@@ -1055,6 +1055,30 @@ if 1 == 0 (
@tab@
@tab@
) else echo block containing two lines with just tab seems to work
::
echo @if 1 == 1 (> blockclosing.cmd
echo echo with closing bracket>> blockclosing.cmd
echo )>> blockclosing.cmd
cmd.exe /Q /C blockclosing.cmd
echo %ERRORLEVEL% ok
::
echo @if 1 == 1 (> blockclosing.cmd
echo echo without closing bracket first>> blockclosing.cmd
echo echo without closing bracket second>> blockclosing.cmd
cmd.exe /Q /C blockclosing.cmd
echo %ERRORLEVEL% two lines
::
echo echo before both blocks> blockclosing.cmd
echo @if 1 == 1 (>> blockclosing.cmd
echo echo before nested block without closing bracket>> blockclosing.cmd
echo @if 2 == 2 (>> blockclosing.cmd
echo echo without closing bracket>> blockclosing.cmd
echo )>> blockclosing.cmd
echo echo outside of block without closing bracket>> blockclosing.cmd
cmd.exe /Q /C blockclosing.cmd
echo %ERRORLEVEL% nested
::
del blockclosing.cmd
echo --- case sensitivity with and without /i option
if bar==BAR echo if does not default to case sensitivity
if not bar==BAR echo if seems to default to case sensitivity
...
...
programs/cmd/tests/test_builtins.cmd.exp
View file @
c418771a
...
...
@@ -713,6 +713,11 @@ block containing a line with just space and tab seems to work
block containing a line with just tab and space seems to work
block containing two lines with just space seems to work
block containing two lines with just tab seems to work
with closing bracket
0 ok
255 two lines
before both blocks
255 nested
--- case sensitivity with and without /i option
if seems to default to case sensitivity
if /i seems to work
...
...
programs/cmd/wcmdmain.c
View file @
c418771a
...
...
@@ -2347,6 +2347,13 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
}
}
if
(
curDepth
>
lineCurDepth
)
{
WINE_TRACE
(
"Brackets do not match, error out without executing.
\n
"
);
WCMD_free_commands
(
*
output
);
*
output
=
NULL
;
errorlevel
=
255
;
}
/* Dump out the parsed output */
WCMD_DumpCommands
(
*
output
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment