-
Notifications
You must be signed in to change notification settings - Fork 172
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(net): Fix the WinError 10014 #954
Conversation
When sendto_v4 and sendto_v6 are called, the error WinError 10014 is raised, caused by passing the wrong sockaddr_len Note: WSAEFAULT(10014), Bad address. The system detected an invalid pointer address in attempting to use a pointer argument of a call. This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr).
1. remove the space in sento_v6 2. Explicitly declares the conversion type c::socklen_t
add `()` to call sizeof function
Thanks! Would you be able to add a testcase that shows the failure here? Or, do you have any guess as to why the net_v4_sendto and net_v6_sendto tests in tests/net/connect_bind_send.rs don't catch this? |
I've now figured out why the existing tests don't fail. They were only testing on stream sockets, where the |
Thanks for finding and fixing this bug! |
This is now released in rustix 0.38.26. |
When sendto_v4 and sendto_v6 are called,
the error WinError 10014 is raised, caused
by passing the wrong sockaddr_len
Note: WSAEFAULT(10014), Bad address.
The system detected an invalid pointer
address in attempting to use a pointer
argument of a call. This error occurs
if an application passes an invalid
pointer value, or if the length of the
buffer is too small. For instance, if
the length of an argument, which is a
sockaddr structure, is smaller than
the sizeof(sockaddr).