From 869ae01da989e202a1a63f0cac11b1f09f2423c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20L=C3=A9caud=C3=A9?= Date: Thu, 10 Nov 2016 16:45:01 -0500 Subject: [PATCH] Add security checks --- nodes/core/io/31-tcpin.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nodes/core/io/31-tcpin.js b/nodes/core/io/31-tcpin.js index 71c9a3def..65feb48b6 100644 --- a/nodes/core/io/31-tcpin.js +++ b/nodes/core/io/31-tcpin.js @@ -439,7 +439,9 @@ module.exports = function(RED) { //node.log(RED._("tcpin.errors.client-connected")); node.status({fill:"green",shape:"dot",text:"common.status.connected"}); node.connected = true; - clients[cid].write(msg.payload); + if (clients[cid]) { + clients[cid].write(msg.payload); + } }); } else { @@ -459,7 +461,7 @@ module.exports = function(RED) { for (var j = 0; j < data.length; j++ ) { if (node.out === "time") { // do the timer thing - if (clients[cid].timeout) { + if (clients[cid] && clients[cid].timeout) { i += 1; buf[i] = data[j]; }