diff --git a/pkg/util/net.go b/pkg/util/net.go index d5b79e43114..927cde141e0 100644 --- a/pkg/util/net.go +++ b/pkg/util/net.go @@ -37,7 +37,11 @@ func Ip2BigInt(ipStr string) *big.Int { } func BigInt2Ip(ipInt *big.Int) string { - ip := net.IP(ipInt.Bytes()) + buf := make([]byte, 4) + if len(ipInt.Bytes()) > 4 { + buf = make([]byte, 16) + } + ip := net.IP(ipInt.FillBytes(buf)) return ip.String() }