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

websockets fails with messages over 16bits #249

Open
alanswx opened this issue May 23, 2019 · 1 comment
Open

websockets fails with messages over 16bits #249

alanswx opened this issue May 23, 2019 · 1 comment

Comments

@alanswx
Copy link

alanswx commented May 23, 2019

in: https://github.com/davidmoreno/onion/blob/master/src/onion/websocket.c#L207
header[3 + 8 - i] = tlen & 0x0FF;

I am pretty sure the 3 should be a 1:

header[1 + 8 - i] = tlen & 0x0FF;

There may also be a 32 vs 64 bit problem on systems where int isn't 64 bits.

@YggdrasiI
Copy link
Contributor

I think this old issue can be closed.

The assumption that header[3+X] needs to be changed to header[1+X] is wrong: The size will be stored two bytes after the opcode (reference https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers )

The 64bit width of size_t is still a problem, so for unrealistic big packages the type
of len should be changed to ssize_t, too.

int tlen = len;

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

No branches or pull requests

2 participants