From 918eb6de41844fbb3f8fd6aca33807da3502d83e Mon Sep 17 00:00:00 2001 From: Brian White Date: Fri, 27 Aug 2021 11:53:13 -0400 Subject: [PATCH] Protocol: add type check Fixes: https://github.com/mscdex/ssh2/issues/1059 --- lib/protocol/Protocol.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/protocol/Protocol.js b/lib/protocol/Protocol.js index 7d4573f0..e00f1eb5 100644 --- a/lib/protocol/Protocol.js +++ b/lib/protocol/Protocol.js @@ -1669,6 +1669,9 @@ class Protocol { const origSignal = name; + if (typeof origSignal !== 'string' || !origSignal) + throw new Error(`Invalid signal: ${origSignal}`); + let signal = name.toUpperCase(); if (signal.slice(0, 3) === 'SIG') signal = signal.slice(3);