Skip to content

Commit

Permalink
Fix writing truncated packets starting with large string/buffer
Browse files Browse the repository at this point in the history
fixes #1438
  • Loading branch information
dougwilson committed Jun 8, 2016
1 parent 82614d6 commit e931562
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This file is a manually maintained list of changes for each release. Feel free
to add your changes here when sending pull requests. Also send corrections if
you spot any mistakes.

## HEAD

* Fix writing truncated packets starting with large string/buffer #1438

## v2.11.0 (2016-06-06)

* Add `POOL_CLOSED` code to "Pool is closed." error
Expand Down
2 changes: 1 addition & 1 deletion lib/protocol/PacketWriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ PacketWriter.prototype.writeLengthCodedString = function(value) {

PacketWriter.prototype._allocate = function _allocate(bytes) {
if (!this._buffer) {
this._buffer = new Buffer(BUFFER_ALLOC_SIZE);
this._buffer = new Buffer(Math.max(BUFFER_ALLOC_SIZE, bytes));
this._offset = 0;
return;
}
Expand Down

0 comments on commit e931562

Please sign in to comment.