Author: jmorlan Date: Thu Mar 26 09:31:46 2009 New Revision: 40248
URL: http://svn.reactos.org/svn/reactos?rev=40248&view=rev Log: - Fix a buffer overflow in cmd - Make "CMD /C" clean up before exiting to get rid of spurious "memory leak" debug messages
Modified: trunk/reactos/base/shell/cmd/cmd.c
Modified: trunk/reactos/base/shell/cmd/cmd.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.c?rev=40... ============================================================================== --- trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] Thu Mar 26 09:31:46 2009 @@ -335,7 +335,7 @@ need rewrite some code to use cmd_realloc when it need instead of add 512bytes extra */
- first = cmd_alloc ( (_tcslen(First) + 512) * sizeof(TCHAR)); + first = cmd_alloc ( (_tcslen(Full) + 512) * sizeof(TCHAR)); if (first == NULL) { error_out_of_memory(); @@ -343,7 +343,7 @@ return FALSE; }
- rest = cmd_alloc ( (_tcslen(Rest) + 512) * sizeof(TCHAR)); + rest = cmd_alloc ( (_tcslen(Full) + 512) * sizeof(TCHAR)); if (rest == NULL) { cmd_free (first); @@ -1540,7 +1540,7 @@ { PARSED_COMMAND *Cmd;
- do + while (!bCanExit || !bExit) { Cmd = ParseCommand(NULL); if (!Cmd) @@ -1549,7 +1549,6 @@ ExecuteCommand(Cmd); FreeCommand(Cmd); } - while (!bCanExit || !bExit);
return nErrorLevel; } @@ -1891,7 +1890,7 @@ GetCmdLineCommand(commandline, &ptr[2], AlwaysStrip); ParseCommandLine(commandline); if (option != _T('K')) - cmd_exit(nErrorLevel); + bExit = TRUE; } }