mirror of https://github.com/reactos/reactos.git
[FREELDR] Skip NULL-pointer entries in Argv when enumerating arguments.
A NULL pointer (not necessarily the terminating one) is a valid entry in the Argv argument vector, according to the ARC specification (Section 4.4 "Loaded-Program Conventions"). Thus, such pointer needs to be ignored when searching over the argument vector.
This commit is contained in:
parent
93245d385d
commit
c044201472
|
@ -23,9 +23,10 @@ GetNextArgumentValue(
|
|||
|
||||
for (i = (LastIndex ? *LastIndex : 0); i < Argc; ++i)
|
||||
{
|
||||
if (strlen(Argv[i]) >= ArgNameLen + 1 /* Count the '=' sign */ &&
|
||||
_strnicmp(Argv[i], ArgumentName, ArgNameLen) == 0 &&
|
||||
Argv[i][ArgNameLen] == '=')
|
||||
if (Argv[i] /* NULL pointer is a valid entry in Argv: skip it */ &&
|
||||
(strlen(Argv[i]) >= ArgNameLen + 1 /* Count the '=' sign */) &&
|
||||
(_strnicmp(Argv[i], ArgumentName, ArgNameLen) == 0) &&
|
||||
(Argv[i][ArgNameLen] == '='))
|
||||
{
|
||||
/* Found it, return the value */
|
||||
if (LastIndex) *LastIndex = i;
|
||||
|
|
Loading…
Reference in New Issue