diff options
author | Henrique Mendonca <henrique@apache.org> | 2012-09-24 19:11:19 +0000 |
---|---|---|
committer | Henrique Mendonca <henrique@apache.org> | 2012-09-24 19:11:19 +0000 |
commit | 41dfe6fd5eee6716ef31e65509d6f30a34189c7b (patch) | |
tree | aa327ff25c696a38fe6390fcc3c6460337bbdb80 | |
parent | ffb031d74ea3dbcfe271bd098fbe8642f57f7e69 (diff) | |
download | thrift-41dfe6fd5eee6716ef31e65509d6f30a34189c7b.tar.gz |
Thrift-1701:node.js TBufferedTransport buffer corruption
Patch: Marshall Roch
fix buffer copy method calls
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1389517 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | lib/nodejs/lib/thrift/transport.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/nodejs/lib/thrift/transport.js b/lib/nodejs/lib/thrift/transport.js index a926a6d86..06351a4a8 100644 --- a/lib/nodejs/lib/thrift/transport.js +++ b/lib/nodejs/lib/thrift/transport.js @@ -165,7 +165,7 @@ TBufferedTransport.prototype = { var bufSize = (unreadedSize * 2 > this.defaultReadBufferSize) ? unreadedSize * 2 : this.defaultReadBufferSize; var buf = new Buffer(bufSize); if (unreadedSize > 0) { - this.inBuf.copy(buf, 0, this.readCursor, unreadedSize); + this.inBuf.copy(buf, 0, this.readCursor, this.writeCursor); } this.readCursor = 0; this.writeCursor = unreadedSize; @@ -195,7 +195,7 @@ TBufferedTransport.prototype = { throw new InputBufferUnderrunError(); } var buf = new Buffer(this.writeCursor - this.readCursor); - this.inBuf.copy(buf, 0, this.readCursor, this.writeCursor - this.readCursor); + this.inBuf.copy(buf, 0, this.readCursor, this.writeCursor); this.readCursor = this.writeCursor; return buf; }, |