-
Notifications
You must be signed in to change notification settings - Fork 30
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
Prevent future potential UB in unix wrapper for getpwuid()
#104
Conversation
The `_passwd` variable is only used in one of the code blocks, so let's declare it in that block.
bc51e20
to
34c9b06
Compare
The docs tests are already failing on the v1 branch |
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.
Thanks for opening this PR!
The cleanups make sense, although as-is I think this potentially introduces unsoundness with a potential null dereference in getpwuid_r()
. I don't believe there are any existing soundness bugs with using uninitialized memory here, as the API is used with passing a pointer to uninitialized memory in the man page example (although for the related function getpwnam_r()
).
I'll work on getting the doc tests passing.
While the warnings do exist, the tests are passing. The failure is due to a segmentation fault caused by your changes. |
This commit makes it so the function doesn't compile on unexpected OSs instead of returning uninitialized data.
34c9b06
to
f617aee
Compare
Heh, funny that only the doc tests broke. I've simply dropped one of the commits. |
getpwuid()
getpwuid()
getpwuid()
No description provided.