Skip to content

Commit

Permalink
fix uninitialized variable block.tunnelID
Browse files Browse the repository at this point in the history
  • Loading branch information
rex4539 committed Jan 30, 2025
1 parent 60d3e4d commit ff0b6a6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions libi2pd/Tunnel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,22 +300,28 @@ namespace tunnel
void OutboundTunnel::SendTunnelDataMsgTo (const uint8_t * gwHash, uint32_t gwTunnel, std::shared_ptr<i2p::I2NPMessage> msg)
{
TunnelMessageBlock block;
block.tunnelID = 0; // Initialize tunnelID to a default value

if (gwHash)
{
block.hash = gwHash;
if (gwTunnel)
{
block.deliveryType = eDeliveryTypeTunnel;
block.tunnelID = gwTunnel;
block.tunnelID = gwTunnel; // Set tunnelID only if gwTunnel is non-zero
}
else
{
block.deliveryType = eDeliveryTypeRouter;
}
}
else
{
block.deliveryType = eDeliveryTypeLocal;
}

block.data = msg;

SendTunnelDataMsgs ({block});
SendTunnelDataMsgs({block});
}

void OutboundTunnel::SendTunnelDataMsgs (const std::vector<TunnelMessageBlock>& msgs)
Expand Down

0 comments on commit ff0b6a6

Please sign in to comment.