Skip to content

Commit

Permalink
0.4.7
Browse files Browse the repository at this point in the history
Fixes previous commit by rolling back changes made by 0.4.6 on #14
  • Loading branch information
dresende committed Sep 27, 2016
1 parent 451b7b9 commit f88df45
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/Server/ReadStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ ReadStream.prototype._transform = function (chunk, encoding, next) {
this.pending = Buffer.concat([ this.pending, chunk ]);
}

while (this.pending.length >= 12) {
while (this.pending.length >= 6) {
var pkg_len = this.pending.readUInt16BE(4) + 6;

if (this.pending.length < pkg_len) return next();
if (pkg_len < 12) return next(); // every function code needs at least 4 additional bytes for "from" and "to". TODO: for WRITE_MULTIPLE_*, we could even check in more detail

var data = this.pending.slice(8, pkg_len);
var pkg = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name" : "modbus-tcp",
"version" : "0.4.6",
"version" : "0.4.7",
"description" : "Modbus TCP/IP",
"main" : "lib/Modbus.js",
"repository" : "http://github.com/dresende/node-modbus-tcp.git",
Expand Down

0 comments on commit f88df45

Please sign in to comment.