Skip to content
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

Handle unacceptable name gracefully in {User,Group}::from_name #1815

Merged
merged 1 commit into from
Sep 12, 2022

Conversation

magicant
Copy link
Contributor

Calling unwrap on the result of CString::new may cause the current thread to panic, which is a bit surprising undocumented behavior. It would be more reasonable to treat the erroneous name as a non-existing user or group.

Calling `unwrap` on the result of `CString::new` may cause the current
thread to panic, which is a bit surprising undocumented behavior. It
would be more reasonable to treat the erroneous name as a non-existing
user or group.
@magicant magicant marked this pull request as ready for review September 11, 2022 14:09
Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

bors r+

bors bot added a commit that referenced this pull request Sep 11, 2022
1815: Handle unacceptable name gracefully in {User,Group}::from_name r=asomers a=magicant

Calling `unwrap` on the result of `CString::new` may cause the current thread to panic, which is a bit surprising undocumented behavior. It would be more reasonable to treat the erroneous name as a non-existing user or group.

Co-authored-by: WATANABE Yuki <magicant@wonderwand.net>
@bors
Copy link
Contributor

bors bot commented Sep 11, 2022

Build failed:

@asomers
Copy link
Member

asomers commented Sep 12, 2022

The build should be fixed if you rebase.

@asomers
Copy link
Member

asomers commented Sep 12, 2022

Actually, maybe bors is smart enough to do that.

bors r+

@bors bors bot merged commit 8e167c7 into nix-rust:master Sep 12, 2022
@magicant magicant deleted the user_from_name_with_nul branch September 12, 2022 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants