Browse Source

fix #1253 handle incorrect values of SIGNATURE_TYPE and CRYPTO_TYPE

pull/1258/head
orignal 6 years ago
parent
commit
9e12cff317
  1. 18
      libi2pd_client/SAM.cpp

18
libi2pd_client/SAM.cpp

@ -1027,12 +1027,30 @@ namespace client
{ {
auto it = params->find (SAM_PARAM_SIGNATURE_TYPE); auto it = params->find (SAM_PARAM_SIGNATURE_TYPE);
if (it != params->end ()) if (it != params->end ())
{
// TODO: extract string values // TODO: extract string values
try
{
signatureType = std::stoi(it->second); signatureType = std::stoi(it->second);
}
catch (const std::exception& ex)
{
LogPrint (eLogWarning, "SAM: ", SAM_PARAM_SIGNATURE_TYPE, "error: ", ex.what ());
}
}
it = params->find (SAM_PARAM_CRYPTO_TYPE); it = params->find (SAM_PARAM_CRYPTO_TYPE);
if (it != params->end ()) if (it != params->end ())
{
try
{
cryptoType = std::stoi(it->second); cryptoType = std::stoi(it->second);
} }
catch (const std::exception& ex)
{
LogPrint (eLogWarning, "SAM: ", SAM_PARAM_CRYPTO_TYPE, "error: ", ex.what ());
}
}
}
localDestination = i2p::client::context.CreateNewLocalDestination (true, signatureType, cryptoType, params); localDestination = i2p::client::context.CreateNewLocalDestination (true, signatureType, cryptoType, params);
} }
if (localDestination) if (localDestination)

Loading…
Cancel
Save