{"id":"GHSA-c439-chv8-8g2j","aliases":["GHSA-c439-chv8-8g2j","RUSTSEC-2022-0052"],"related":[],"kind":"vulnerability","state":"published","title":"`os_socketaddr` invalidly assumes the memory layout of std::net::SocketAddr","summary":"The [`os_socketaddr`](https://crates.io/crates/os_socketaddr) crate has assumed `std::net::SocketAddrV4` and `std::net::SocketAddrV6` have the same memory layout as the system C representation `sockaddr`. It has simply casted the pointers to convert the socket addresses to the system representation.\n\nThese layout were [changed into idiomatic rust types](https://github.com/rust-lang/rust/pull/78802) in nightly `std`. Starting from rustc 1.64 the affected versions of this crate will have undefined behaviour.","summaryFormat":"markdown","summarySource":"ghsa","descriptions":[{"lang":"en","text":"The [`os_socketaddr`](https://crates.io/crates/os_socketaddr) crate has assumed `std::net::SocketAddrV4` and `std::net::SocketAddrV6` have the same memory layout as the system C representation `sockaddr`. It has simply casted the pointers to convert the socket addresses to the system representation.\n\nThese layout were [changed into idiomatic rust types](https://github.com/rust-lang/rust/pull/78802) in nightly `std`. Starting from rustc 1.64 the affected versions of this crate will have undefined behaviour.","format":"markdown","source":"ghsa"}],"published":"2022-08-26T12:00:00.000Z","modified":"2023-11-08T04:18:12.374Z","severity":{"scorer":"GitHub","scheme":"rating","rating":"HIGH"},"severities":[{"scorer":"GitHub","scheme":"rating","rating":"HIGH"}],"cwes":[],"affected":[{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.2.2"}],"ecosystem":"crates.io","package":"os_socketaddr","purl":"pkg:cargo/os_socketaddr","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.2.2"}],"ecosystem":"crates.io","package":"os_socketaddr","purl":"pkg:cargo/os_socketaddr","source":"rustsec"}],"references":[{"url":"https://github.com/a-ba/os_socketaddr/issues/3","tags":["report","web"],"sources":["ghsa","rustsec"]},{"url":"https://github.com/rust-lang/rust/pull/78802","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/a-ba/os_socketaddr/commit/1bc7f71d40de069727993a18fdada33eb0b4c94f","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/a-ba/os_socketaddr","tags":["package"],"sources":["ghsa"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2022-0052.html","tags":["advisory","web"],"sources":["ghsa","rustsec"]},{"url":"https://crates.io/crates/os_socketaddr","tags":["package"],"sources":["rustsec"]}],"credits":[],"sources":[{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-c439-chv8-8g2j","url":"https://github.com/advisories/GHSA-c439-chv8-8g2j","licence":"CC-BY-4.0","modified":"2023-11-08T04:18:12.374Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2022-0052","url":"https://rustsec.org/advisories/RUSTSEC-2022-0052.html","licence":"CC0-1.0","modified":"2023-11-08T04:18:12.374Z"}],"updatedAt":"2026-11-25T22:56:43.108Z"}