mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 05:55:42 +00:00
[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
1 changed files with 4 additions and 3 deletions
|
@ -23,9 +23,10 @@ GetNextArgumentValue(
|
||||||
|
|
||||||
for (i = (LastIndex ? *LastIndex : 0); i < Argc; ++i)
|
for (i = (LastIndex ? *LastIndex : 0); i < Argc; ++i)
|
||||||
{
|
{
|
||||||
if (strlen(Argv[i]) >= ArgNameLen + 1 /* Count the '=' sign */ &&
|
if (Argv[i] /* NULL pointer is a valid entry in Argv: skip it */ &&
|
||||||
_strnicmp(Argv[i], ArgumentName, ArgNameLen) == 0 &&
|
(strlen(Argv[i]) >= ArgNameLen + 1 /* Count the '=' sign */) &&
|
||||||
Argv[i][ArgNameLen] == '=')
|
(_strnicmp(Argv[i], ArgumentName, ArgNameLen) == 0) &&
|
||||||
|
(Argv[i][ArgNameLen] == '='))
|
||||||
{
|
{
|
||||||
/* Found it, return the value */
|
/* Found it, return the value */
|
||||||
if (LastIndex) *LastIndex = i;
|
if (LastIndex) *LastIndex = i;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue