mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
check for malformed b33
This commit is contained in:
parent
3acfb129cd
commit
3f0534134d
@ -139,6 +139,11 @@ namespace data
|
|||||||
{
|
{
|
||||||
uint8_t addr[40]; // TODO: define length from b33
|
uint8_t addr[40]; // TODO: define length from b33
|
||||||
size_t l = i2p::data::Base32ToByteStream (b33.c_str (), b33.length (), addr, 40);
|
size_t l = i2p::data::Base32ToByteStream (b33.c_str (), b33.length (), addr, 40);
|
||||||
|
if (l < 32)
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "Blinding: malformed b33 ", b33);
|
||||||
|
return;
|
||||||
|
}
|
||||||
uint32_t checksum = crc32 (0, addr + 3, l - 3);
|
uint32_t checksum = crc32 (0, addr + 3, l - 3);
|
||||||
// checksum is Little Endian
|
// checksum is Little Endian
|
||||||
addr[0] ^= checksum; addr[1] ^= (checksum >> 8); addr[2] ^= (checksum >> 16);
|
addr[0] ^= checksum; addr[1] ^= (checksum >> 8); addr[2] ^= (checksum >> 16);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user