pushrax / node-rcon

A generic RCON protocol client for node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

response for incomplete buffers

aikar opened this issue · comments

the lib is not checking that the full response has been received before issueing the response event, resulting in response firing for a partial event and then again with the full data.

To fix, line 146 needs to be if (len >= 10 && data.length >= len + 4) {

This isn't only thing needed since sending multiple commands still has same issue. investigating more.

Then end of method

  } else {
    this.emit('error', new Error("Authentication failed"));
  }
  data = data.slice(12 + len - 8);
} else {
  // Keep a reference to the chunk if it doesn't represent a full packet
  this.outstandingData = data;
  break;
}