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

Avoid buffer overrun with 'binary' encoding #1624

Closed
wants to merge 1 commit into from
Closed

Avoid buffer overrun with 'binary' encoding #1624

wants to merge 1 commit into from

Conversation

koichik
Copy link

@koichik koichik commented Sep 1, 2011

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
Copy link

ry commented Sep 1, 2011

LGTM

@koichik
Copy link
Author

koichik commented Sep 2, 2011

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