[cmd/help]
authorChristoph von Wittich <christoph_vw@reactos.org>
Mon, 20 Oct 2014 09:21:08 +0000 (09:21 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Mon, 20 Oct 2014 09:21:08 +0000 (09:21 +0000)
do not call wcslen on uninitialized variable

svn path=/trunk/; revision=64842

reactos/base/applications/cmdutils/help/help.c

index 668e930..24ac9d8 100644 (file)
@@ -16,6 +16,7 @@
 #include <winbase.h>
 #include <winuser.h>
 #include <wincon.h>
+#include <strsafe.h>
 
 #include "help.h"
 #include "resource.h"
@@ -135,9 +136,8 @@ int wmain(int argc, WCHAR* argv[])
     /*
      * Run "<command> /?" in the current command processor.
      */
-    wcsncpy(CmdLine, argv[1], CMDLINE_LENGTH - wcslen(CmdLine));
-    wcsncat(CmdLine, L" /?" , CMDLINE_LENGTH - wcslen(CmdLine));
-
+    StringCbPrintfW(CmdLine, sizeof(CmdLine), L"%ls /?", argv[1]);
+    
     _flushall();
     return _wsystem(CmdLine);
 }