accounts/abi: properly quote untrusted data in error message (#26110)

* abi: Format data as hex-string instead of string(data)

* Update accounts/abi/abi.go

Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
Nicolas Gotchac 2022-11-07 07:58:00 -05:00 committed by GitHub
parent 17744639da
commit 111ed1af1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,7 +87,7 @@ func (abi ABI) getArguments(name string, data []byte) (Arguments, error) {
var args Arguments
if method, ok := abi.Methods[name]; ok {
if len(data)%32 != 0 {
return nil, fmt.Errorf("abi: improperly formatted output: %s - Bytes: [%+v]", string(data), data)
return nil, fmt.Errorf("abi: improperly formatted output: %q - Bytes: %+v", data, data)
}
args = method.Outputs
}