Medium, CVSS 4.0crates.ioPublished
stellar-xdr's StringM::from_str bypasses max length validation
CVE-2026-29795 · GHSA-x57h-xx53-v53w
- Affected
- crates.io stellar-xdr <= 25.0.0
- Fixed in
- 25.0.1· Vendor fix available
- Issue
- Impact StringM::fromstr does not validate that the input length is within the declared maximum (MAX). Calling StringM::<N::fromstr(s) where s is longer than N bytes succeeds and returns an Ok value instead of Err(Error::LengthExceedsMax), producing a StringM that violates its length invariant. This affects any code that constructs StringM values from string input using FromStr (including str::parse), and relies on the type's maximum length constraint being enforced. An oversized StringM could propagate through serialization, validation, or other logic that assumes the invariant holds. All published versions of the stellar-xdr crate up to and including v25.0.0 are affected. Patches The fix is merged in #500. It replaces the direct Ok(Self(b)) construction with b.tryinto(), which routes through TryFrom<Vec<u8 and properly validates the length — matching the pattern already used by BytesM::fromstr. Users should upgrade to the first release containing this fix once published (the next…
Recommended action: Upgrade to 25.0.1 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.