# GHSA-jh2m-fhpj-3vr7: xattr functions mark unwritten bytes as initialized when given a zero-length buffer

- Severity: not scored yet
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2026-10-27T12:00:00.000Z
- Modified: 2026-11-11T08:45:02.466Z
- Also known as: RUSTSEC-2026-0486

## Description

The extended-attribute functions in `rustix::fs` (`getxattr`, `lgetxattr`, `fgetxattr`, `listxattr`, `llistxattr` and `flistxattr`) write into a `Buffer` and then mark as many bytes initialized as the system call reported. When the buffer has zero length, the operating system treats the call as a size query: it writes nothing and returns the size of the attribute value or of the name list. rustix still marked that many bytes as initialized.

Passing a `Vec` whose length equals its capacity through `spare_capacity` gives such a zero-length buffer, and rustix then set the vector's length past its capacity over memory that was never written. This is undefined behavior reachable from safe code. With an empty `&mut [MaybeUninit<u8>]` the call panics instead.

From 1.1.6 these functions return an empty result for a zero-length buffer, and new `getxattr_query`, `lgetxattr_query`, `fgetxattr_query`, `listxattr_query`, `llistxattr_query` and `flistxattr_query` functions return the size. The 0.38 series did not have the `Buffer` API and is not affected.

(As written by RustSec Advisory Database.)

## Affected

- rustix (crates.io): from 1.0.0 before 1.1.6

## References

- <https://crates.io/crates/rustix> (package)
- <https://rustsec.org/advisories/RUSTSEC-2026-0486.html> (advisory)
- <https://github.com/bytecodealliance/rustix/commit/8e6aaa6713d2bb64b1fdd8c472e3a32a10a76d70> (web)

## Sources

- RustSec Advisory Database: [RUSTSEC-2026-0486](https://rustsec.org/advisories/RUSTSEC-2026-0486.html), CC0-1.0, modified 2026-11-11

---

Page: https://cve.day/GHSA-jh2m-fhpj-3vr7 · Whole record: https://cve.day/GHSA-jh2m-fhpj-3vr7.json · Rebuilt by cve.day 2026-11-25T22:56:43.481Z
