From aa9c1b66a046c2aa699dff8f1689345dacbd106e Mon Sep 17 00:00:00 2001 From: Life Coder Date: Mon, 25 Feb 2019 09:57:18 +0100 Subject: [PATCH] Fix #1257 --- libi2pd_client/SAM.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libi2pd_client/SAM.cpp b/libi2pd_client/SAM.cpp index 0dc73d72..d21f4051 100644 --- a/libi2pd_client/SAM.cpp +++ b/libi2pd_client/SAM.cpp @@ -359,6 +359,20 @@ namespace client } forward = std::make_shared(addr, port); } + + //ensure we actually received a destination + if (destination.empty()) + { + SendMessageReply (SAM_SESSION_STATUS_INVALID_KEY, strlen(SAM_SESSION_STATUS_INVALID_KEY), true); + return; + } + + //ensure it's a base64 string + if (!keys.FromBase64(destination)) + { + SendMessageReply(SAM_SESSION_STATUS_INVALID_KEY, strlen(SAM_SESSION_STATUS_INVALID_KEY), true); + return; + } // create destination auto session = m_Owner.CreateSession (id, destination == SAM_VALUE_TRANSIENT ? "" : destination, ¶ms);