# git2 has potential undefined behavior when dereferencing Buf struct

Source: https://junglewise.ai/threats/git2-has-potential-undefined-behavior-when-dereferencing-buf-struct-12fe5959  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-02-04  
License: CC BY 4.0 with a link back

Severity: medium · CVSS 4 · Published 2026-02-04

git2 has potential undefined behavior when dereferencing Buf struct

Technologies: [git2 (crates.io)](https://junglewise.ai/threats/technologies/git2). Vendors: [crates.io](https://junglewise.ai/threats/vendors/crates-io).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Medium severity, with a CVSS score of 4, published 4 February 2026.

**Which products and versions are affected?** git2 (crates.io) SEMVER:introduced=0,fixed=0.20.4.

**Is there a fix for This vulnerability?** Yes. git2 (crates.io): upgrade to 0.20.4 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**Am I affected?** Check whether you run git2 (crates.io) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- git2 (crates.io): upgrade to 0.20.4 or later

  ```sh
  cargo update -p git2
  ```


## Affected products

- git2 (crates.io) SEMVER:introduced=0,fixed=0.20.4

## Related threats

- [RUSTSEC-2026-0184 - Potential undefined behavior with Signature from a buffer-created BlameHunk](https://junglewise.ai/threats/rustsec-2026-0184-potential-undefined-behavior-with-signature-from-a-caaa89e6)
- [RUSTSEC-2026-0183 - Potential undefined behavior when calling Remote::list()](https://junglewise.ai/threats/rustsec-2026-0183-potential-undefined-behavior-when-calling-remote-list-81c95b20)
- [RUSTSEC-2026-0008 - Potential undefined behavior when dereferencing Buf struct](https://junglewise.ai/threats/rustsec-2026-0008-potential-undefined-behavior-when-dereferencing-buf-6f571e76)
- [RUSTSEC-2023-0003 - git2 does not verify SSH keys by default](https://junglewise.ai/threats/cve-2023-22742-git2-rs-fails-to-verify-ssh-keys-by-default)
- [RUSTSEC-2023-0002 - git2 Rust package suppresses ssh host key checking](https://junglewise.ai/threats/rustsec-2023-0002-git2-rust-package-suppresses-ssh-host-key-checking-8d7f91ab)
