Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cmd/rpc): plaintext parsing of data for blob.Submit and state.SubmitPayForBlob #2340

Merged
merged 1 commit into from
Jun 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmd/celestia/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down