Skip to content

Commit

Permalink
ShellPkg: Fix copy-pasto in NULL check to prevent segfault
Browse files Browse the repository at this point in the history
The documentation says "If OldArgv or OldArgc is NULL then that value is
not returned."

However, only OldArgc was checked for NULL. In case OldArgc was non-NULL,
but OldArgv was null, it would cause a segmentation fault.

Signed-off-by: Tormod Volden <[email protected]>
  • Loading branch information
tormodvolden committed Jul 25, 2024
1 parent 556640b commit d9f7f9f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ShellPkg/Application/Shell/ShellParametersProtocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ UpdateArgcArgv (
*OldArgc = ShellParameters->Argc;
}

if (OldArgc != NULL) {
if (OldArgv != NULL) {
*OldArgv = ShellParameters->Argv;
}

Expand Down

0 comments on commit d9f7f9f

Please sign in to comment.