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

Fix UB in getsockopt #1214

Merged
merged 1 commit into from
Apr 13, 2020
Merged

Fix UB in getsockopt #1214

merged 1 commit into from
Apr 13, 2020

Conversation

asomers
Copy link
Member

@asomers asomers commented Apr 12, 2020

The old code tried to zero-initialize an enum for which 0 is not a valid
value. That worked for older compilers, but triggers a panic with Rust
1.44.0. The correct technique is to use mem::MaybeUninit.

Fixes #1212

The old code tried to zero-initialize an enum for which 0 is not a valid
value.  That worked for older compilers, but triggers a panic with Rust
1.44.0.  The correct technique is to use mem::MaybeUninit.

Fixes nix-rust#1212
@asomers
Copy link
Member Author

asomers commented Apr 12, 2020

@srikwit could you please review?

@srikwit
Copy link

srikwit commented Apr 13, 2020

Yes I am reviewing it.

@srikwit
Copy link

srikwit commented Apr 13, 2020

All tests have passed! LGTM.

Copy link
Member Author

@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.

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 13, 2020

Build succeeded

@bors bors bot merged commit 154ff58 into nix-rust:master Apr 13, 2020
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.

Can't zero-initialize SockType
2 participants