GHSA-j39j-6gw9-jw6h json
git2 has potential undefined behavior when dereferencing Buf struct
published 9mo ago modified 2mo ago also RUSTSEC-2026-0008
- cvss
- —
- not scored
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- —
- no score, EPSS covers CVEs only
- public exploits
- 0
- none known
Summary
If the Buf struct is dereferenced immediately after calling new() or default() on the Buf struct, a null pointer is passed to the unsafe function slice::from_raw_parts. According to the safety section documentation of the function, data must be non-null and aligned even for zero-length slices or slices of ZSTs. Thus, passing a null pointer will lead to undefined behavior.
Patch / fix
- crates.io git2 0.20.4
- github.com/rust-lang/git2-rs@9e160f1 commit
- github.com/rust-lang/git2-rs#1213 pull request
Is GHSA-j39j-6gw9-jw6h in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.
Check with FencerAffected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| crates.io | git2 | <0.20.4 >=0.0.0-0, <0.20.4 |
0.20.4 |
Classification
- Weakness
-
- CWE-476 NULL Pointer Dereference
References
-
github.com
/rust-lang/git2-rs/pull/1213
web
-
github.com
/rust-lang/git2-rs/commit/9e160f15bd056f82143109bb330573381e5de719
web
-
github.com
/rust-lang/git2-rs/issues/1211
web
-
github.com
/rust-lang/git2-rs
package
-
rustsec.org
/advisories/RUSTSEC-2026-0008.html
web, advisory
-
crates.io
/crates/git2
package
Sources
- GitHub Advisory GHSA-j39j-6gw9-jw6h
- OSV RUSTSEC-2026-0008
Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.