From 93d2c5c2185c5f24cd09b40ccf780f9c7784ef00 Mon Sep 17 00:00:00 2001 From: lukema95 <867273263@qq.com> Date: Wed, 7 Feb 2024 11:34:39 +0800 Subject: [PATCH] fix the integer overflow warning from cosmos-sec --- x/crosschain/client/cli/cli_whitelist_erc20.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/x/crosschain/client/cli/cli_whitelist_erc20.go b/x/crosschain/client/cli/cli_whitelist_erc20.go index eabc252705..2f3af566d5 100644 --- a/x/crosschain/client/cli/cli_whitelist_erc20.go +++ b/x/crosschain/client/cli/cli_whitelist_erc20.go @@ -1,6 +1,7 @@ package cli import ( + "fmt" "strconv" "github.com/cosmos/cosmos-sdk/client" @@ -33,6 +34,9 @@ func CmdWhitelistERC20() *cobra.Command { if err != nil { return err } + if decimals > 128 { + return fmt.Errorf("decimals must be less than 128") + } gasLimit, err := strconv.ParseInt(args[5], 10, 64) if err != nil { @@ -45,6 +49,7 @@ func CmdWhitelistERC20() *cobra.Command { chainID, name, symbol, + // #nosec G701 always in range uint32(decimals), gasLimit, )