mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-20 16:26:39 +01:00
don't use fixed size buffer for local destination's keys
This commit is contained in:
parent
706b9c51b1
commit
c2f6731296
1 changed files with 3 additions and 7 deletions
|
@ -470,15 +470,11 @@ namespace client
|
||||||
auto session = m_Owner.FindSession(m_ID);
|
auto session = m_Owner.FindSession(m_ID);
|
||||||
if (session)
|
if (session)
|
||||||
{
|
{
|
||||||
uint8_t buf[1024];
|
std::string priv = session->GetLocalDestination ()->GetPrivateKeys ().ToBase64 ();
|
||||||
char priv[1024];
|
|
||||||
size_t l = session->GetLocalDestination ()->GetPrivateKeys ().ToBuffer (buf, 1024);
|
|
||||||
size_t l1 = i2p::data::ByteStreamToBase64 (buf, l, priv, 1024);
|
|
||||||
priv[l1] = 0;
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
size_t l2 = sprintf_s (m_Buffer, SAM_SOCKET_BUFFER_SIZE, SAM_SESSION_CREATE_REPLY_OK, priv);
|
size_t l2 = sprintf_s (m_Buffer, SAM_SOCKET_BUFFER_SIZE, SAM_SESSION_CREATE_REPLY_OK, priv.c_str ());
|
||||||
#else
|
#else
|
||||||
size_t l2 = snprintf (m_Buffer, SAM_SOCKET_BUFFER_SIZE, SAM_SESSION_CREATE_REPLY_OK, priv);
|
size_t l2 = snprintf (m_Buffer, SAM_SOCKET_BUFFER_SIZE, SAM_SESSION_CREATE_REPLY_OK, priv.c_str ());
|
||||||
#endif
|
#endif
|
||||||
SendMessageReply (m_Buffer, l2, false);
|
SendMessageReply (m_Buffer, l2, false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue