From 1517ba0a4b7c34ffbd4bfdd894e539071c7cf513 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 5836bdb..4512681 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);