-
Notifications
You must be signed in to change notification settings - Fork 674
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
sockaddr_storage_to_addr is documented as being more lenient with the size than it is in practice #1479
Comments
Yes, I think you're probably right. Doing it as documented shouldn't lead to a memory leak. But do you have any examples of something that creates a sockaddr_in or sockaddr_in6 as a sockaddr_storage with too much space? |
When doing strace-like things it's convenient to grab |
That makes sense. Care to submit a patch? |
When I have a chance, sure. |
1486: Relax assertions in sockaddr_storage_to_addr to match the documentation. r=asomers a=khuey Fixes #1479 1490: add libc::IP6T_SO_ORIGINAL_DST to socket opt r=asomers a=bearice the original PR #1410 was stalled for a while let's make it happen. this should closes #1410 and #938 1493: Fix crates.io badge r=asomers a=atouchet Co-authored-by: Kyle Huey <[email protected]> Co-authored-by: Icemic <[email protected]> Co-authored-by: Bearice Ren <[email protected]> Co-authored-by: Alex Touchet <[email protected]>
1486: Relax assertions in sockaddr_storage_to_addr to match the documentation. r=asomers a=khuey Fixes #1479 Co-authored-by: Kyle Huey <[email protected]>
1486: Relax assertions in sockaddr_storage_to_addr to match the documentation. r=asomers a=khuey Fixes #1479 1490: add libc::IP6T_SO_ORIGINAL_DST to socket opt r=asomers a=bearice the original PR #1410 was stalled for a while let's make it happen. this should closes #1410 and #938 1493: Fix crates.io badge r=asomers a=atouchet Co-authored-by: Kyle Huey <[email protected]> Co-authored-by: Icemic <[email protected]> Co-authored-by: Bearice Ren <[email protected]> Co-authored-by: Alex Touchet <[email protected]>
The documentation says
This suggests that passing in a size larger than what is actually used (say,
size_of::<sockaddr_storage>()
) should be fine. But in the implementation, bothAF_INET
andAF_INET6
assert that the size passed is exactlysize_of::<sockaddr_in>()
/size_of::<sockaddr_in6>()
. Ideally IMO the implementation would match the documented behavior.The text was updated successfully, but these errors were encountered: