Merge pull request #503 from faern/net2-socketaddr

Add advisory on net2 making invalid memory assumptions
This commit is contained in:
Sergey "Shnatsel" Davidoff
2020-12-03 00:22:22 +01:00
committed by GitHub

View File

@@ -0,0 +1,22 @@
```toml
[advisory]
id = "RUSTSEC-0000-0000"
package = "net2"
date = "2020-11-07"
url = "https://github.com/deprecrated/net2-rs/issues/105"
keywords = ["memory", "layout", "cast"]
informational = "unsound"
[versions]
patched = [">= 0.2.36"]
```
# `net2` invalidly assumes the memory layout of std::net::SocketAddr
The [`net2`](https://crates.io/crates/net2) 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 addresess 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.