From 4ee1e5e81feaeb498cce66ef379408190c5ecab1 Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 7 Jun 2023 14:55:01 +0200 Subject: [PATCH] fix(cmd/rpc): plaintext parsing of data for blob.Submit and state.SubmitPayForBlob --- cmd/celestia/rpc.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/celestia/rpc.go b/cmd/celestia/rpc.go index 7992e8f2a8..4139e0f709 100644 --- a/cmd/celestia/rpc.go +++ b/cmd/celestia/rpc.go @@ -138,6 +138,8 @@ func parseParams(method string, params []string) []interface{} { blobData = decoded case strings.HasPrefix(params[1], "\""): // user input an utf string that needs to be encoded to base64 + src := []byte(params[1]) + blobData = make([]byte, base64.StdEncoding.EncodedLen(len(src))) base64.StdEncoding.Encode(blobData, []byte(params[1])) default: // otherwise, we assume the user has already encoded their input to base64 @@ -178,6 +180,8 @@ func parseParams(method string, params []string) []interface{} { blobData = decoded case strings.HasPrefix(params[3], "\""): // user input an utf string that needs to be encoded to base64 + src := []byte(params[1]) + blobData = make([]byte, base64.StdEncoding.EncodedLen(len(src))) base64.StdEncoding.Encode(blobData, []byte(params[3])) default: // otherwise, we assume the user has already encoded their input to base64