Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. socket2
  4. ›
  5. GHSA-p5w9-856p-8q4g

GHSA-p5w9-856p-8q4g: Assumed memory layout of std::net::SocketAddr

August 25, 2021

The socket2 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. The standard library does not say anything about the memory layout, and this will cause invalid memory access if the standard library changes the implementation. No warnings or errors will be emitted once the change happens.

References

  • github.com/advisories/GHSA-p5w9-856p-8q4g
  • github.com/rust-lang/socket2-rs
  • github.com/rust-lang/socket2-rs/issues/119
  • rustsec.org/advisories/RUSTSEC-2020-0079.html

Code Behaviors & Features

Detect and mitigate GHSA-p5w9-856p-8q4g with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 0.3.16

Fixed versions

  • 0.3.16

Solution

Upgrade to version 0.3.16 or above.

Weakness

  • CWE-824: Access of Uninitialized Pointer

Source file

cargo/socket2/GHSA-p5w9-856p-8q4g.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:15:09 +0000.