From 111ed1af1b2fbd936e5fb4b0d685f509b2e6f6a6 Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Mon, 7 Nov 2022 07:58:00 -0500 Subject: [PATCH] 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 --- accounts/abi/abi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/abi/abi.go b/accounts/abi/abi.go index 81bbee2f2b..841d3c6cb6 100644 --- a/accounts/abi/abi.go +++ b/accounts/abi/abi.go @@ -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 }