Uh oh!
There was an error while loading. Please reload this page.
dgram: fix send with out of bounds offset + length - #40568
Conversation
4e3776a to
6b2f4fcCompare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
nodejs-github-bot
commented
Oct 22, 2021
Uh oh!
There was an error while loading. Please reload this page.
mscdex
commented
Oct 22, 2021
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
3fdfdacCompare
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
63a0887Compare3b23094 to
b392a94Comparenodejs-github-bot
commented
Oct 23, 2021
nodejs-github-bot
commented
Oct 23, 2021
nodejs-github-bot
commented
Oct 23, 2021
dcde72f to
c829552Comparenodejs-github-bot
commented
Oct 24, 2021
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