Skip to content

Commit

Permalink
Merge pull request #79 from plcpeople/78-hotfix
Browse files Browse the repository at this point in the history
Hotfix for #78
  • Loading branch information
plcpeople committed May 24, 2019
2 parents 5027536 + 2a4c092 commit 0e99abd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions nodeS7.js
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,15 @@ NodeS7.prototype.onResponse = function(theData) {

// NOT SO FAST - can't do this here. If we time out, then later get the reply, we can't decrement this twice. Or the CPU will not like us. Do it if not rcvd. self.parallelJobsNow--;

// hotfix for #78, prevents RangeErrors for undersized packets
if (!(theData && theData.length > 6)) {
outputLog('INVALID READ RESPONSE - DISCONNECTING');
outputLog("The incoming packet doesn't have the required minimum length of 7 bytes");
outputLog(theData);
self.connectionReset();
return;
}

var data=checkRFCData(theData);

if(data==="fastACK"){
Expand Down

0 comments on commit 0e99abd

Please sign in to comment.