File tree Expand file tree Collapse file tree
base/applications/network/netsh Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -281,19 +281,22 @@ PrintCommandHelp(
281281{
282282 LPWSTR pszCommandBuffer ;
283283 DWORD_PTR Args [2 ];
284+ DWORD dwLength = 1 ;
284285
285286 DPRINT ("PrintCommandHelp(%p %p %p)\n" , pContext , pGroup , pCommand );
286287
287- pszCommandBuffer = HeapAlloc (GetProcessHeap (), 0 , TINY_HELP_BUFFER_SIZE * sizeof (WCHAR ));
288+ dwLength += wcslen (pCommand -> pwszCmdToken );
289+ if (pGroup )
290+ dwLength += (wcslen (pGroup -> pwszCmdGroupToken ) + 1 );
291+
292+ pszCommandBuffer = HeapAlloc (GetProcessHeap (), 0 , dwLength * sizeof (WCHAR ));
288293 if (pszCommandBuffer == NULL )
289294 return ;
290295
291- wcscpy (pszCommandBuffer , pCommand -> pwszCmdToken );
292- if (pGroup )
293- {
294- wcscat (pszCommandBuffer , L" " );
295- wcscat (pszCommandBuffer , pGroup -> pwszCmdGroupToken );
296- }
296+ _swprintf (pszCommandBuffer , L"%s%s%s" ,
297+ (pGroup ) ? pGroup -> pwszCmdGroupToken : L"" ,
298+ (pGroup ) ? L" " : L"" ,
299+ pCommand -> pwszCmdToken );
297300
298301 Args [0 ] = (DWORD_PTR )pszCommandBuffer ;
299302 Args [1 ] = (DWORD_PTR )NULL ;
You can’t perform that action at this time.
0 commit comments