GHSA-j39j-6gw9-jw6h git2 has potential undefined behavior when dereferencing Buf struct

Not scored Published

A null pointer dereference in the git2 Rust library can cause undefined behavior and potential crashes when using the Buf struct.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Not stated
Victim action needed
Not needed
Fix
Available

What is GHSA-j39j-6gw9-jw6h?

GHSA-j39j-6gw9-jw6h is a vulnerability in git2, published on 2 Feb 2026.

Official description

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.

Which versions are affected by GHSA-j39j-6gw9-jw6h?

3 open source packages ship an affected version, including git2.

PackageAffectedFixed in
git2 crates.ioAll versions0.20.4
git2 crates.ioAll versions0.20.4
git2 crates.ioFrom 0.0.0-00.20.4

How do I fix GHSA-j39j-6gw9-jw6h?

Upgrade git2 to 0.20.4 or later.

Is GHSA-j39j-6gw9-jw6h being exploited?

There is no known exploitation of GHSA-j39j-6gw9-jw6h in the wild and no public exploit code.

Sources

Also known as RUSTSEC-2026-0008.

Is GHSA-j39j-6gw9-jw6h in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free