From e58aaa3f32cb80bfbcd7eba0cd1f5a10c017e8ae Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 7 Mar 2018 12:36:38 -0500 Subject: [PATCH] make sure tunnelID is non-zero --- libi2pd/TunnelConfig.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libi2pd/TunnelConfig.h b/libi2pd/TunnelConfig.h index 7267fc30..9707fa17 100644 --- a/libi2pd/TunnelConfig.h +++ b/libi2pd/TunnelConfig.h @@ -35,6 +35,7 @@ namespace tunnel RAND_bytes (replyKey, 32); RAND_bytes (replyIV, 16); RAND_bytes ((uint8_t *)&tunnelID, 4); + if (!tunnelID) tunnelID = 1; // tunnelID can't be zero isGateway = true; isEndpoint = true; ident = r; @@ -50,6 +51,7 @@ namespace tunnel nextIdent = ident; isEndpoint = false; RAND_bytes ((uint8_t *)&nextTunnelID, 4); + if (!nextTunnelID) nextTunnelID = 1; // tunnelID can't be zero } void SetReplyHop (uint32_t replyTunnelID, const i2p::data::IdentHash& replyIdent)