-
Notifications
You must be signed in to change notification settings - Fork 151
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
recvmsg_uninit
does not work with MSG_TRUNC
#1153
Comments
sunfishcode
added a commit
that referenced
this issue
Sep 9, 2024
With the `TRUNC` flag, `recv` returns the untruncated length, which may be longer than the provided buffer. Fix `recv_uninit` and `recvfrom_uninit` to handle this case. This mean that `recv_uninit` and `recvfrom_uninit` are unable to return the full untruncated length returned by `recv` with the `TRUNC` flag, however it appears that fixing that may require API changes. Fixes #1153.
sunfishcode
added a commit
that referenced
this issue
Sep 11, 2024
* Fix `recv_uninit` to handle the `TRUNC` flag. With the `TRUNC` flag, `recv` returns the untruncated length, which may be longer than the provided buffer. Fix `recv_uninit` and `recvfrom_uninit` to handle this case. This mean that `recv_uninit` and `recvfrom_uninit` are unable to return the full untruncated length returned by `recv` with the `TRUNC` flag, however it appears that fixing that may require API changes. Fixes #1153. * Add comments mentioning alternatives.
sunfishcode
added a commit
that referenced
this issue
Sep 11, 2024
* Fix `recv_uninit` to handle the `TRUNC` flag. With the `TRUNC` flag, `recv` returns the untruncated length, which may be longer than the provided buffer. Fix `recv_uninit` and `recvfrom_uninit` to handle this case. This mean that `recv_uninit` and `recvfrom_uninit` are unable to return the full untruncated length returned by `recv` with the `TRUNC` flag, however it appears that fixing that may require API changes. Fixes #1153. * Add comments mentioning alternatives.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
recvfrom(2)
has aMSG_TRUNC
flag that makes it "return the real length of the packet or datagram, even when it was longer than the passed buffer."This leads to panic since
rustix::net::recvmsg_uninit
tries to split the return buffer according to the returned length.rustix::net::recvfrom
doesn't suffer from this issue since it just returns the length directly. But it also doesn't support uninit buffers.The text was updated successfully, but these errors were encountered: