Skip to content

Changes in memory layout of the std net types will result in UB #9

Closed
@ghost

Description

Context: rust-lang/rust#78802 and https://www.reddit.com/r/rust/comments/wcw93o/a_major_refactor_of_rusts_ip_address/

These lines caught my eye while I was reading the code:

netif/src/lib.rs

Lines 189 to 190 in 550ec42

// Leans on the fact that SocketAddrV4 and SocketAddrV6 are
// transparent wrappers around SOCKADDR.

netif/src/lib.rs

Lines 331 to 332 in 550ec42

// Leans on the fact that SocketAddrV4 and SocketAddrV6 are
// transparent wrappers around sockaddr_in and sockaddr_in6.

A lot of crates were recently patched to remove the assumption of the memory layout of network primitives. Any code continuing to do so will result in UB, so I wanted to raise this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions