summaryrefslogtreecommitdiffstats
path: root/ShellPkg
diff options
context:
space:
mode:
authorTormod Volden <debian.tormod@gmail.com>2024-07-25 10:31:14 +0200
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-11-24 17:15:24 +0000
commit800205678fc9f4d290890de2db1e1de87759da66 (patch)
tree6b246995256b9ecf93450659b11cbbfdb44bc9c1 /ShellPkg
parent6142f0a8a53557ba50300c762a15bf3c18382162 (diff)
downloadedk2-800205678fc9f4d290890de2db1e1de87759da66.tar.gz
ShellPkg: Fix check on OldArgv in UpdateArgcArgv()
The UpdateArgcArgv() function documentation says "If OldArgv or OldArgc is NULL then that value is not returned." However, only OldArgc was checked for NULL, probably because of copy-pasto. In case OldArgc was non-NULL, but OldArgv was null, it could cause a segmentation fault. Check OldArgv is not NULL before dereferencing the value. Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Application/Shell/ShellParametersProtocol.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c b/ShellPkg/Application/Shell/ShellParametersProtocol.c
index 8464cbf616..1784898169 100644
--- a/ShellPkg/Application/Shell/ShellParametersProtocol.c
+++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c
@@ -1470,7 +1470,7 @@ UpdateArgcArgv (
*OldArgc = ShellParameters->Argc;
}
- if (OldArgc != NULL) {
+ if (OldArgv != NULL) {
*OldArgv = ShellParameters->Argv;
}