Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Avoid buffer overrun with 'binary' encoding#1624

Closed
koichik wants to merge 1 commit into
nodejs:v0.4from
koichik:fix-buffer-overrun
Closed

Avoid buffer overrun with 'binary' encoding#1624
koichik wants to merge 1 commit into
nodejs:v0.4from
koichik:fix-buffer-overrun

Conversation

@koichik

@koichik koichik commented Sep 1, 2011

Copy link
Copy Markdown

With 'binary' encoding, Buffer.write() overruns the buffer's length.
reproduce:

> buf = new Buffer([0, 0, 0, 0, 0]);
<Buffer 00 00 00 00 00>
> sub = buf.slice(0, 4);
<Buffer 00 00 00 00>
> sub.write('12345', 'binary')
5
> buf
<Buffer 31 32 33 34 35>

Please review.

@ry

ry commented Sep 1, 2011

Copy link
Copy Markdown

LGTM

@koichik

koichik commented Sep 2, 2011

Copy link
Copy Markdown
Author

Thanks!

@koichik koichik closed this in 96ede8c Sep 2, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants