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 from_raw() #18

Merged
merged 2 commits into from
Oct 17, 2023
Merged

Fix from_raw() #18

merged 2 commits into from
Oct 17, 2023

Conversation

tormol
Copy link
Owner

@tormol tormol commented Oct 15, 2023

Fixes #17.

It would do out-of-bounds reads for addresses with length equal to
sizeof(sun_path)-path_offset(), and panic for any other lengths.

It had not been tested, and due to that second part
I assume it has never been used.

Fixes #17.
Some OSes, including macOS, have a non-standard length field
right after sun_family.

Not including space for it in UnixSocketAddr.length breaks from_raw()
and always including it is probably a good idea.
@tormol tormol merged commit a367f45 into master Oct 17, 2023
6 checks passed
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.

Unsoundness: Incorrect safety invariant checks in UnixSocketAddr::from_raw()
2 participants