mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-29 12:17:49 +02:00
verify jump link for valid characters
This commit is contained in:
parent
c8ae15041f
commit
3286bdb4a7
4 changed files with 60 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2022, The PurpleI2P Project
|
||||
* Copyright (c) 2013-2023, The PurpleI2P Project
|
||||
*
|
||||
* This file is part of Purple i2pd project and licensed under BSD3
|
||||
*
|
||||
|
@ -403,10 +403,20 @@ namespace client
|
|||
if (!addr)
|
||||
return false;
|
||||
|
||||
i2p::data::IdentityEx ident;
|
||||
if (ident.FromBase64 (jump) && ident.GetIdentHash () == addr->identHash)
|
||||
return true;
|
||||
|
||||
auto pos = jump.find(".b32.i2p");
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
i2p::data::IdentHash identHash;
|
||||
if (identHash.FromBase32(jump.substr (0, pos)) && identHash == addr->identHash)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
i2p::data::IdentityEx ident;
|
||||
if (ident.FromBase64 (jump) && ident.GetIdentHash () == addr->identHash)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue