From 79d2ff2760d59fbaf2b4e1c040fcd211323fa052 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Tue, 27 Oct 2020 09:38:02 -0700 Subject: [PATCH] KEX Packet Follows Fix 1. When filtering out the unknown names from name lists, the one that will be the client's guess KEX type can get removed if unknown. Let the first item in the client's list be added if unknown. --- src/internal.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/internal.c b/src/internal.c index cdd5dfb..5892ab2 100644 --- a/src/internal.c +++ b/src/internal.c @@ -1914,7 +1914,10 @@ static int GetNameList(byte* idList, word32* idListSz, WLOG(WS_LOG_DEBUG, "DNL: name ID = %s", displayName); } } - if (id != ID_UNKNOWN) { + if (id != ID_UNKNOWN || idListIdx == 0) { + /* Intentionally save the first one if unknown. This helps + * skipping the KexDhInit if the client sends the wrong one + * as a guess. */ if (idListIdx >= *idListSz) { WLOG(WS_LOG_ERROR, "No more space left for names"); return WS_BUFFER_E;