[ros-diffs] [turner] 22690: Unicode fixes and error checking.

turner at svn.reactos.org turner at svn.reactos.org
Thu Jun 29 17:08:10 CEST 2006


Author: turner
Date: Thu Jun 29 19:08:10 2006
New Revision: 22690

URL: http://svn.reactos.org/svn/reactos?rev=22690&view=rev
Log:
Unicode fixes and error checking.

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=22690&r1=22689&r2=22690&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/batch.c (original)
+++ trunk/reactos/base/shell/cmd/batch.c Thu Jun 29 19:08:10 2006
@@ -275,8 +275,17 @@
     //
     // Allocate enough memory to hold the params and copy them over without modifications
     //
-    bc->raw_params = malloc(_tcslen(param));
-    _tcscpy(bc->raw_params,param);
+    bc->raw_params = malloc((_tcslen(param)+1) * sizeof(TCHAR));
+    if (bc->raw_params != NULL)
+    {
+        memset (bc->raw_params, 0, _tcslen(bc->raw_params) * sizeof(TCHAR));
+        _tcscpy(bc->raw_params,param);
+    }
+    else
+    {
+        error_out_of_memory();
+        return FALSE;
+    }
 
 #ifdef _DEBUG
 	DebugPrintf (_T("Batch: returns TRUE\n"));




More information about the Ros-diffs mailing list