Skip to content

Commit

Permalink
cmd/evm: ensure input length is even (ethereum#24721)
Browse files Browse the repository at this point in the history
* cmd/evm: ensure input length is even

* cmd/evm: minor nit + lintfix

Co-authored-by: Martin Holst Swende <martin@swende.se>
  • Loading branch information
2 people authored and jagdeep sidhu committed May 5, 2022
1 parent f71417c commit a13feb7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/evm/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,12 @@ func runCmd(ctx *cli.Context) error {
} else {
hexInput = []byte(ctx.GlobalString(InputFlag.Name))
}
input := common.FromHex(string(bytes.TrimSpace(hexInput)))
hexInput = bytes.TrimSpace(hexInput)
if len(hexInput)%2 != 0 {
fmt.Println("input length must be even")
os.Exit(1)
}
input := common.FromHex(string(hexInput))

var execFunc func() ([]byte, uint64, error)
if ctx.GlobalBool(CreateFlag.Name) {
Expand Down

0 comments on commit a13feb7

Please sign in to comment.