-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
dgram: fix send with out of bounds offset + length #40568
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
Conversation
4e3776a to
6b2f4fc
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Do we need to do the same checks for non-strings as well? The same test file verifies errors are thrown for some ranges, but I'm not sure if it covers all cases. |
I think you're correct and that the following (for example) might show a similar error: sock.send(Buffer.from('hello'), 3, 4);Maybe I should add the check for all inputs. |
6b2f4fc to
3fdfdac
Compare
It looks like in addition to strings, checks for |
fix Socket.prototype.send sending garbage when the message is a string, or Buffer and offset+length is out of bounds. Fixes: nodejs#40491
3fdfdac to
63a0887
Compare
3b23094 to
b392a94
Compare
dcde72f to
c829552
Compare
|
Landed in 3b9044b...2413283 |
fix
Socket.prototype.sendsending garbage when the message is astring, andoffset+lengthis out of bounds.When a string message was sent with offset/length, the underlying buffer from
Buffer.fromwas sent without checking the original string's length, and garbage was sent if length/offset were too long. Instead, the method now throws anERR_OUT_OF_RANGEERR_BUFFER_OUT_OF_BOUNDSerror.Edit:
Also added checks for Buffers
Fixes: #40491