-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ShellPkg: Fix copy-pasto in NULL check to prevent segfault #5968
Conversation
This PR has been automatically marked as stale because it has not had activity in 60 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions. |
keep-alive |
Close and re-open to get reviewers assigned |
Thanks! I tried to close and reopen some other PRs of mine, but no reviewers were added. EDIT: I see now they were not added immediately here either, so I may just have to be patient. EDIT 2: Indeed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code change itself looks ok, maybe just to be a bit more concise in the commit message:
ShellPkg: Fix check on OldArgv in UpdateArgcArgv()
Check OldArgv is not NULL before dereferencing the value.
07d03be
to
bc10ad2
Compare
@pierregondois Thanks for the suggestion. I rebased to current master and amended the commit message. I think it is still worth mentioning that the bug could cause a segmentation fault. |
@tormodvolden Thanks for updating the commit message. I think you could still remove this part:
or in general, be less verbose and more factual:
|
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 <[email protected]>
bc10ad2
to
8a05fa2
Compare
I rebased to latest master. |
Description
The UpdateArgcArgv() function 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 could cause a segmentation fault.
How This Was Tested
Not tested. Not sure if any of the current code calls UpdateArgcArgv() with OldArgc non-NULL and OldArgv NULL.
Integration Instructions
N/A