# GHSA-c439-chv8-8g2j: `os_socketaddr` invalidly assumes the memory layout of std::net::SocketAddr

- Severity: High (rating, scored by GitHub)
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2022-08-26T12:00:00.000Z
- Modified: 2023-11-08T04:18:12.374Z
- Also known as: RUSTSEC-2022-0052

## Description

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.

These 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.

(As written by GitHub Advisory Database.)

## Affected

- os_socketaddr (crates.io): before 0.2.2; from 0.0.0-0 before 0.2.2

## References

- <https://github.com/a-ba/os_socketaddr/issues/3> (report, web)
- <https://github.com/rust-lang/rust/pull/78802> (web)
- <https://github.com/a-ba/os_socketaddr/commit/1bc7f71d40de069727993a18fdada33eb0b4c94f> (web)
- <https://github.com/a-ba/os_socketaddr> (package)
- <https://rustsec.org/advisories/RUSTSEC-2022-0052.html> (advisory, web)
- <https://crates.io/crates/os_socketaddr> (package)

## Sources

- GitHub Advisory Database: [GHSA-c439-chv8-8g2j](https://github.com/advisories/GHSA-c439-chv8-8g2j), CC-BY-4.0, modified 2023-11-08
- RustSec Advisory Database: [RUSTSEC-2022-0052](https://rustsec.org/advisories/RUSTSEC-2022-0052.html), CC0-1.0, modified 2023-11-08

---

Page: https://cve.day/GHSA-c439-chv8-8g2j · Whole record: https://cve.day/GHSA-c439-chv8-8g2j.json · Rebuilt by cve.day 2026-11-25T22:56:43.108Z
