Fixed the allocation of some buffers in Execute.
Modified: trunk/reactos/subsys/system/cmd/cmd.c

Modified: trunk/reactos/subsys/system/cmd/cmd.c
--- trunk/reactos/subsys/system/cmd/cmd.c	2005-09-10 15:18:42 UTC (rev 17777)
+++ trunk/reactos/subsys/system/cmd/cmd.c	2005-09-10 15:20:10 UTC (rev 17778)
@@ -299,6 +299,7 @@
 	TCHAR *first = NULL;
 	TCHAR *rest = NULL; 
 	TCHAR *full = NULL; 
+        TCHAR *dot = NULL;
 	TCHAR szWindowTitle[MAX_PATH];
 	DWORD dwExitCode = 0;
 
@@ -310,14 +311,14 @@
 	   need rewrite some code to use realloc when it need instead 
 	   of add 512bytes extra */
 
-	first = malloc ( _tcslen(First) + 512 * sizeof(TCHAR)); 
+	first = malloc ( (_tcslen(First) + 512) * sizeof(TCHAR)); 
 	if (first == NULL)
 	{
 	 error_out_of_memory();
 	 return ;
 	}
 
-	rest =	malloc ( _tcslen(Rest) + 512 * sizeof(TCHAR)); 
+	rest =	malloc ( (_tcslen(Rest) + 512) * sizeof(TCHAR)); 
 	if (rest == NULL)
 	{
 	 free (full);
@@ -325,7 +326,7 @@
 	 return ;
 	}
 
-	full =	malloc ( _tcslen(Full) + 512 * sizeof(TCHAR));
+	full =	malloc ( (_tcslen(Full) + 512) * sizeof(TCHAR));
 	if (full == NULL)
 	{
 	 free (full);
@@ -411,8 +412,8 @@
 	GetConsoleTitle (szWindowTitle, MAX_PATH);
 
 	/* check if this is a .BAT or .CMD file */
-	if (!_tcsicmp (_tcsrchr (szFullName, _T('.')), _T(".bat")) ||
-		!_tcsicmp (_tcsrchr (szFullName, _T('.')), _T(".cmd")))
+        dot = _tcsrchr (szFullName, _T('.'));
+	if (dot && (!_tcsicmp (dot, _T(".bat")) || !_tcsicmp (dot, _T(".cmd"))))
 	{
 #ifdef _DEBUG
 		DebugPrintf (_T("[BATCH: %s %s]\n"), szFullName, rest);