Author: cwittich
Date: Sun Jan 20 15:21:39 2008
New Revision: 31901
URL:
http://svn.reactos.org/svn/reactos?rev=31901&view=rev
Log:
fix a buffer overflow
Modified:
trunk/reactos/base/shell/cmd/batch.c
Modified: trunk/reactos/base/shell/cmd/batch.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/batch.c?rev…
==============================================================================
--- trunk/reactos/base/shell/cmd/batch.c (original)
+++ trunk/reactos/base/shell/cmd/batch.c Sun Jan 20 15:21:39 2008
@@ -262,7 +262,10 @@
/* Then we are transferring to another batch */
CloseHandle (bc->hBatchFile);
bc->hBatchFile = INVALID_HANDLE_VALUE;
- cmd_free (bc->params);
+ if (bc->params)
+ cmd_free (bc->params);
+ if (bc->raw_params)
+ cmd_free (bc->raw_params);
}
bc->hBatchFile = hFile;
@@ -280,7 +283,7 @@
bc->raw_params = (TCHAR*) cmd_alloc((_tcslen(param)+1) * sizeof(TCHAR));
if (bc->raw_params != NULL)
{
- memset (bc->raw_params, 0, _tcslen(bc->raw_params) * sizeof(TCHAR));
+ memset (bc->raw_params, 0, (_tcslen(param)+1) * sizeof(TCHAR));
_tcscpy(bc->raw_params,param);
}
else