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 of incorrect message size in functions getpeername, getsockname #13107

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Denzeli
Copy link

@Denzeli Denzeli commented Dec 25, 2020

No description provided.

@welcome
Copy link

welcome bot commented Dec 25, 2020

Thank you for submitting a pull request! If this is your first PR, make sure to add yourself to AUTHORS.

@Denzeli Denzeli changed the title Fixes incorrect message size in functions getpeername, getsockname. #… Fixes incorrect message size in functions getpeername, getsockname Dec 25, 2020
@Denzeli Denzeli changed the title Fixes incorrect message size in functions getpeername, getsockname Fix of incorrect message size in functions getpeername, getsockname Dec 25, 2020
@sbc100 sbc100 requested a review from juj December 25, 2020 11:32
Base automatically changed from master to main March 8, 2021 23:49
@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Apr 16, 2022
@pjaggi1
Copy link

pjaggi1 commented Oct 25, 2023

If you can please merge at some point that would be good-annoying bug if you happen to use the POSIX Sockets proxy server.

@juj
Copy link
Collaborator

juj commented Oct 25, 2023

Sorry, this fell completely through the cracks..

Looking at the code, I don't think the change is correct? The sockaddr field is varying in length, so its actual size is dynamically defined.

It looks to me like the code would change the sockaddr size to be zero, as sizeof(d) does not include the size of the sockaddr, just the header.

If this change is panning out for some use, I wonder if it would be due to masking some other bug?

Now while looking at this, I see that at least on Unix implementations of POSIX, hthere should exist a type sockaddr_storage that would be large enough to store any type of address (IPv4 or IPv6). https://man7.org/linux/man-pages/man3/sockaddr.3type.html Maybe that would be better to use here.

@pjaggi1
Copy link

pjaggi1 commented Oct 25, 2023

I am a little confused-it seems like this change affects the call from the web assembly to the websocket_to_posix_proxy. Without this PR the proxy would error out because it was getting a negative packet size. With this fix the proxy unpacks the header and makes the posix getsockname call, for which it allocates its own address buffer (

). Is this not correct?

i am not sure about the data coming back, it looks like there might not be enough allocation for the return buffer? but out to the proxy this seems ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants