mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
Avoid aliasing problems by using special buf endian handling functions wrapping memcpy
This commit is contained in:
parent
4d640dac2a
commit
1636187e26
13 changed files with 68 additions and 40 deletions
|
@ -436,7 +436,7 @@ namespace data
|
|||
else
|
||||
{
|
||||
LogPrint ("RouterInfo");
|
||||
size_t size = be16toh (*(uint16_t *)(buf + offset));
|
||||
size_t size = bufbe16toh (buf + offset);
|
||||
if (size > 2048)
|
||||
{
|
||||
LogPrint ("Invalid RouterInfo length ", (int)size);
|
||||
|
@ -597,10 +597,10 @@ namespace data
|
|||
uint32_t replyTunnelID = 0;
|
||||
if (flag & 0x01) //reply to tunnel
|
||||
{
|
||||
replyTunnelID = be32toh (*(uint32_t *)(buf + 64));
|
||||
replyTunnelID = bufbe32toh (buf + 64);
|
||||
excluded += 4;
|
||||
}
|
||||
uint16_t numExcluded = be16toh (*(uint16_t *)excluded);
|
||||
uint16_t numExcluded = bufbe16toh (excluded);
|
||||
excluded += 2;
|
||||
if (numExcluded > 512)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue