secondlife / secondlife/viewer

[Potential bug?] LLBase64::decodeAsString truncates at null byte

Open
#6,322 3 comments 0 reactions 1 assignee View on GitHub

@akleshchev is already working on this.

Since Sep 15, 2026.

  • #6327 by @FelixWolf — merged
bug
Dominant language
C++
Stars
299
Forks
146
Avg merge
1d 9h
Merged PRs (30d)
88

Description

Environment

26.3.0.31203661088

Description

LLBase64::decodeAsString uses res.assign(b64_buffer);, which copies a string up until \0. I'm unsure if this is intentional or not, given that base64 is typically used to convey byte data rather than string data.
Either way, this came up when debugging. I can write around it if this is intentional, but figured I'd bring it up just in case it isn't.
Easy fix is to just do res.assign(b64_buffer, b64_buffer_length); instead. I can submit a PR if this is deemed a bug.

Reproduction steps
  1. Attempt to decode bytes containing a \0 using LLBase64::decodeAsString
  2. Observe that the output is truncated

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.