{"id":"GHSA-j39j-6gw9-jw6h","aliases":["GHSA-j39j-6gw9-jw6h","RUSTSEC-2026-0008"],"related":[],"kind":"vulnerability","state":"published","title":"git2 has potential undefined behavior when dereferencing Buf struct","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.","summaryFormat":"markdown","summarySource":"ghsa","descriptions":[{"lang":"en","text":"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.","format":"markdown","source":"ghsa"},{"lang":"en","text":"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.","format":"markdown","source":"rustsec"}],"published":"2026-02-02T12:00:00.000Z","modified":"2026-09-10T03:50:35.308Z","severity":{"scorer":"GitHub","scheme":"CVSS:4.0","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","rating":"LOW"},"severities":[{"scorer":"GitHub","scheme":"CVSS:4.0","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","rating":"LOW"}],"cwes":["CWE-476"],"affected":[{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.20.4"}],"ecosystem":"crates.io","package":"git2","purl":"pkg:cargo/git2","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.20.4"}],"ecosystem":"crates.io","package":"git2","purl":"pkg:cargo/git2","source":"rustsec"}],"references":[{"url":"https://github.com/rust-lang/git2-rs/issues/1211","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/rust-lang/git2-rs/pull/1213","tags":["web"],"sources":["ghsa","rustsec"]},{"url":"https://github.com/rust-lang/git2-rs/commit/9e160f15bd056f82143109bb330573381e5de719","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/rust-lang/git2-rs","tags":["package"],"sources":["ghsa"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2026-0008.html","tags":["advisory","web"],"sources":["ghsa","rustsec"]},{"url":"https://crates.io/crates/git2","tags":["package"],"sources":["rustsec"]}],"credits":[],"sources":[{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-j39j-6gw9-jw6h","url":"https://github.com/advisories/GHSA-j39j-6gw9-jw6h","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:35.308Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2026-0008","url":"https://rustsec.org/advisories/RUSTSEC-2026-0008.html","licence":"CC0-1.0","modified":"2026-02-05T06:56:18.869Z"}],"updatedAt":"2026-11-25T22:56:43.301Z"}