From 0c79d1207ef884c98458f62081d03f94a3c274ee Mon Sep 17 00:00:00 2001 From: bobo liu <7552030+fakeboboliu@users.noreply.github.com> Date: Thu, 9 Sep 2021 20:30:34 +0800 Subject: [PATCH] Fix: potential overflow in ssr (#1600) --- transport/ssr/protocol/auth_chain_a.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transport/ssr/protocol/auth_chain_a.go b/transport/ssr/protocol/auth_chain_a.go index 4ce55c1..906f8de 100644 --- a/transport/ssr/protocol/auth_chain_a.go +++ b/transport/ssr/protocol/auth_chain_a.go @@ -278,7 +278,7 @@ func getRandStartPos(length int, random *tools.XorShift128Plus) int { if length == 0 { return 0 } - return int(random.Next()%8589934609) % length + return int(int64(random.Next()%8589934609) % int64(length)) } func (a *authChainA) getRandLength(length int, lastHash []byte, random *tools.XorShift128Plus) int {