Skip to content

Commit

Permalink
Hotfix for #78
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilherme Francescon committed May 21, 2019
1 parent 5027536 commit 2a4c092
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 2a4c092

Please sign in to comment.