Skip to content

Commit

Permalink
Add safe check
Browse files Browse the repository at this point in the history
  • Loading branch information
ferranbt committed Apr 28, 2021
1 parent aa62733 commit 4e88c00
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions abi/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ func decode(t *Type, input []byte) (interface{}, []byte, error) {
var length int
var err error

// safe check, input should be at least 32 bytes
if len(input) < 32 {
return nil, nil, fmt.Errorf("incorrect length")
}

if t.isVariableInput() {
length, err = readLength(input)
if err != nil {
Expand Down

0 comments on commit 4e88c00

Please sign in to comment.