while I'm trying to building a new technic, I've found an interesting bug in CMD.exe.
It enables a debug output option of cmd.exe that shows how characters, tokens and commands are parsed
Like this
Output wrote:if 4==5 echo Hello
GeToken: (4000) 'if'
GeToken: (4000) '4'
Ungetting: ' 4==5 echo Hello
'
GeToken: (4000) '4'
Ungetting: ' 4==5 echo Hello
'
GeToken: (4000) '4'
GeToken: (4000) '==5'
GeToken: (4000) 'echo'
GeToken: (4000) ' Hello'
GeToken: (a) '
'
Ungetting: '
'
GeToken: (a) '
'
Ungetting: '
'
GeToken: (a) '
'
Ungetting: '
'
GeToken: (a) '
'
Ungetting: '
'
GeToken: (a) '
'
Ungetting: '
'
GeToken: (a) '
'
Ungetting: '
'
GeToken: (a) '
'
Ungetting: '
'
GeToken: (a) '
'
Ungetting: '
'
GeToken: (a) '
'
Ungetting: '
'
GeToken: (a) '
'
Ungetting: '
'
GeToken: (a) '
'
Ungetting: '
'
GeToken: (a) '
'
Ungetting: '
'
GeToken: (a) '
'
if
Cmd: 4 Type: 39 Args: `5'
Cmd: echo Type: 0 Args: ` Hello'
And to enable it it's quite simple, building a batch file containing some opening parenthesis (a bit more than 256)
Code: Select all
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
Then the debug output is constantly activated in that cmd-window.
Tested with Win7 x64 cmd.exe Version 6.1.7601.
I suppose it's a simple buffer overrun bug.
If you put far more brackets you get some odd and long output (I discoverd the bug with over 2000 brackets)
Now, have fun to play with it
jeb