common/hexutil: don't leak encoding/hex errors in Decode
All other functions return errors from package hexutil, ensure that Decode does too.
This commit is contained in:
@ -60,7 +60,11 @@ func Decode(input string) ([]byte, error) {
|
||||
if !has0xPrefix(input) {
|
||||
return nil, ErrMissingPrefix
|
||||
}
|
||||
return hex.DecodeString(input[2:])
|
||||
b, err := hex.DecodeString(input[2:])
|
||||
if err != nil {
|
||||
err = mapError(err)
|
||||
}
|
||||
return b, err
|
||||
}
|
||||
|
||||
// MustDecode decodes a hex string with 0x prefix. It panics for invalid input.
|
||||
|
Reference in New Issue
Block a user