From 823819c982d1d620a5662bbdb020a96cfb4a48ef Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 21 Feb 2018 11:38:24 -0700 Subject: [PATCH] handle bad packet more correctly --- lib/tcpd.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tcpd.js b/lib/tcpd.js index 2c4b4e9..2afa8a5 100644 --- a/lib/tcpd.js +++ b/lib/tcpd.js @@ -27,9 +27,10 @@ module.exports.create = function (cli, dnsd) { // TODO pad two bytes for lengths dnsd.onMessage(nb, function (err, newAb, dbgmsg) { - var lenbuf = Buffer.from([ newAb.length >> 8, newAb.length & 255 ]); // TODO XXX generate legit error packet if (err) { console.error("Error", err); c.end(); return; } + + var lenbuf = Buffer.from([ newAb.length >> 8, newAb.length & 255 ]); console.log('TCP ' + dbgmsg); c.write(lenbuf);