Skip to content

Commit 2b29694

Browse files
committed
Add advisory on nb-connect SocketAddr casting
1 parent 0283f67 commit 2b29694

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
```toml
2+
[advisory]
3+
id = "RUSTSEC-0000-0000"
4+
package = "nb-connect"
5+
date = "2021-02-14"
6+
url = "https://github.com/smol-rs/nb-connect/issues/1"
7+
keywords = ["memory", "layout", "cast"]
8+
informational = "unsound"
9+
10+
[versions]
11+
patched = [">= 1.0.3"]
12+
```
13+
14+
# `nb-connect` invalidly assumes the memory layout of std::net::SocketAddr
15+
16+
The [`nb-connect`](https://crates.io/crates/nb-connect) crate has assumed `std::net::SocketAddrV4`
17+
and `std::net::SocketAddrV6` have the same memory layout as the system C representation
18+
`sockaddr`. It has simply casted the pointers to convert the socket addresses to the
19+
system representation. The standard library does not say anything about the memory
20+
layout, and this will cause invalid memory access if the standard library
21+
changes the implementation. No warnings or errors will be emitted once the
22+
change happens.

0 commit comments

Comments
 (0)