revers Revision: 23549 | * allocate a terminating zero for every parsed argument

The code cause a regress. and the old code is 100% correct. I spoken with janderwald about it
*argc can be 0 when it call to CommandLineToArgv and he did not think of it. and agrument 
agrc is always 1, but that can not be take into accunt. for u do not paraser how many argc it exists
you parser the current argv, like is it 0, is it 1 so on. 

 


svn path=/trunk/; revision=23554
This commit is contained in:
Magnus Olsen 2006-08-12 14:51:51 +00:00
parent bdea0e74a9
commit 7fda8aece2

View file

@ -131,7 +131,7 @@ LPTSTR *WINAPI CommandLineToArgv(LPCTSTR lpCmdLine, int *lpArgc)
}
// Allocate space for the pointers in argv and the strings in one block
argv = (LPTSTR *)malloc(argc * sizeof(LPTSTR) + (_tcslen(lpArg) + argc) * sizeof(TCHAR));
argv = (LPTSTR *)malloc(argc * sizeof(LPTSTR) + (_tcslen(lpArg) + 1) * sizeof(TCHAR));
if (!argv) {
// Memory allocation failed