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 unclezoro committed Sep 21, 2022
1 parent 3766168 commit 30c695c
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 30c695c

Please sign in to comment.