Avoid buffer overrun with 'binary' encoding #1624

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@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
ry commented Sep 1, 2011

LGTM

@koichik
koichik commented Sep 2, 2011

Thanks!

@koichik koichik added a commit that closed this pull request Sep 2, 2011
@koichik koichik buffer: Avoid overrun with 'binary' encoding.
Fixes #1624.
96ede8c
@koichik koichik closed this in 96ede8c Sep 2, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment