mirror of
https://github.com/reactos/reactos.git
synced 2024-10-10 19:27:40 +00:00
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:
parent
bdea0e74a9
commit
7fda8aece2
|
@ -131,7 +131,7 @@ LPTSTR *WINAPI CommandLineToArgv(LPCTSTR lpCmdLine, int *lpArgc)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate space for the pointers in argv and the strings in one block
|
// 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) {
|
if (!argv) {
|
||||||
// Memory allocation failed
|
// Memory allocation failed
|
||||||
|
|
Loading…
Reference in a new issue