-
Notifications
You must be signed in to change notification settings - Fork 68
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
bl.append(number) appends a buffer with uninitialized memory #22
Conversation
@@ -52,6 +52,7 @@ BufferList.prototype.append = function (buf) { | |||
var isBuffer = Buffer.isBuffer(buf) || | |||
buf instanceof BufferList | |||
|
|||
if (typeof buf === 'number') buf = buf.toString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline, ==
instead of ===
please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment would also be good
lgtm sans syntax issues |
bl.append(number) no longer appends a buffer with uninitialized memory
@rvagg thanks, fixed as requested :) |
Published as Thanks @feross. |
Nice work. Thanks for going above-and-beyond by backporting to pre-1.0. |
👍, nice! |
This PR changes the behavior of
bl.append(number)
so that it no longer appends a buffer with uninitialized memory of the specified size.The issue is fixed by coercing the argument to a string. (An alternate solution would be to throw an exception in this case.)
This played a role in this issue in request: request/request#2018
Further reading: