{"id":"GHSA-j39j-6gw9-jw6h","aliases":["RUSTSEC-2026-0008"],"status":"published","title":"git2 has potential undefined behavior when dereferencing Buf struct","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.","severity":{"version":"4.0","score":2.7,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:U","level":"low","from":"ghsa"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-476"],"published":"2026-02-02T12:00:00Z","modified":"2026-09-10T03:50:35Z","fixes":[{"ecosystem":"crates.io","package":"git2","fixed_in":["0.20.4"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"crates.io","package":"git2","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.20.4"}]}]},{"source":"osv","ecosystem":"crates.io","package":"git2","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"0.20.4"}]}]},{"source":"osv","ecosystem":"crates.io","package":"git2","ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.0-0"},{"fixed":"0.20.4"}]}]}],"references":[{"url":"https://github.com/rust-lang/git2-rs/issues/1211","tags":["web"]},{"url":"https://github.com/rust-lang/git2-rs/pull/1213","tags":["web"]},{"url":"https://github.com/rust-lang/git2-rs/commit/9e160f15bd056f82143109bb330573381e5de719","tags":["web"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2026-0008.html","tags":["web","advisory"]},{"url":"https://github.com/advisories/GHSA-j39j-6gw9-jw6h"},{"url":"https://github.com/rust-lang/git2-rs","tags":["package"]},{"url":"https://crates.io/crates/git2","tags":["package"]}],"sources":{"ghsa":[{"id":"GHSA-j39j-6gw9-jw6h","title":"git2 has potential undefined behavior when dereferencing Buf struct ","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.","status":"published","published":"2026-02-04T20:36:04Z","modified":"2026-02-04T20:36:07Z","cvss":[{"version":"4.0","score":2.7,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:U","level":"low"}],"cwes":["CWE-476"],"updated_at":"2026-11-02T14:39:22.637668Z"}],"osv":[{"id":"GHSA-j39j-6gw9-jw6h","title":"git2 has potential undefined behavior when dereferencing Buf struct ","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.","status":"published","published":"2026-02-04T20:36:04Z","modified":"2026-09-10T03:50:35.308686138Z","cvss":[{"version":"4.0","score":2.7,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:U","level":"low"}],"cwes":["CWE-476"],"updated_at":"2026-11-02T15:46:49.977351Z"},{"id":"RUSTSEC-2026-0008","title":"Potential undefined behavior when dereferencing Buf struct","description":"if we dereference the Buf struct right after calling new() or default() on Buf struct, it passes Null Pointer to the unsafe function slice::from_raw_parts. Based on the safety section documentation of function,\ndata must be non-null and aligned even for zero-length slices or slices of ZSTs. Thus, passing Null Pointer will lead to undefined behavior.","status":"published","published":"2026-02-02T12:00:00Z","modified":"2026-02-05T06:56:18.869923Z","updated_at":"2026-11-02T15:53:40.430679Z"}]}}
