mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-10-22 21:51:51 +00:00
fix: missing checks and limits
This commit is contained in:
9 files changed
+46
-8
No files matched your search
+16
-2
@@ -709,7 +709,9 @@ namespace http {
|
||||
if (i2cpServer)
|
||||
{
|
||||
s << "<b>I2CP " << tr("Local Destination") << ":</b><br>\r\n<br>\r\n";
|
||||
auto session = i2cpServer->FindSessionByID ((uint16_t)std::stoi (id));
|
||||
std::shared_ptr<i2p::client::I2CPSession> session;
|
||||
try { session = i2cpServer->FindSessionByID ((uint16_t)std::stoi (id)); }
|
||||
catch (std::exception&) {}
|
||||
if (session)
|
||||
ShowLeaseSetDestination (s, session->GetDestination (), 0);
|
||||
else
|
||||
@@ -1505,7 +1507,19 @@ namespace http {
|
||||
std::string redirect = std::to_string(COMMAND_REDIRECT_TIMEOUT) + "; url=" + webroot + "?page=commands";
|
||||
std::string token = params["token"];
|
||||
|
||||
if (token.empty () || m_Tokens.find (std::stoi (token)) == m_Tokens.end ())
|
||||
if (token.empty ())
|
||||
{
|
||||
ShowError(s, tr("Invalid token"));
|
||||
return;
|
||||
}
|
||||
int tokenValue;
|
||||
try { tokenValue = std::stoi (token); }
|
||||
catch (std::exception&)
|
||||
{
|
||||
ShowError(s, tr("Invalid token"));
|
||||
return;
|
||||
}
|
||||
if (m_Tokens.find (tokenValue) == m_Tokens.end ())
|
||||
{
|
||||
ShowError(s, tr("Invalid token"));
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user