From 4148056f05e9c9dd38c5bacef86a34c1a0996284 Mon Sep 17 00:00:00 2001 From: skyfire Date: Thu, 16 Nov 2023 12:46:26 +0800 Subject: [PATCH] Fix #1118: Fix the regular expression in Protocol.js for handling ident information. There is a scenario where some SSH servers return an ident of 'SSH-2.0-' which leads to the throwing of an 'Invalid identification string' exception. This commit addresses compatibility for this scenario. --- lib/protocol/Protocol.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/protocol/Protocol.js b/lib/protocol/Protocol.js index 85e1249a..ecda8468 100644 --- a/lib/protocol/Protocol.js +++ b/lib/protocol/Protocol.js @@ -1909,7 +1909,7 @@ class Protocol { } // SSH-protoversion-softwareversion (SP comments) CR LF -const RE_IDENT = /^SSH-(2\.0|1\.99)-([^ ]+)(?: (.*))?$/; +const RE_IDENT = /^SSH-(2\.0|1\.99)-([^ ]*)(?: (.*))?$/; // TODO: optimize this by starting n bytes from the end of this._buffer instead // of the beginning