You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Handle non-NUL-terminated strings in SocketAddrUnix. (#1371)
* Handle non-NUL-terminated strings in `SocketAddrUnix`.
Unix-domain socket address can be long enough that the NUL terminator does
not fit. Handle this case by making `path()` return a `Cow<CStr>` and
adding a NUL terminator as needed.
Also add a `path_bytes()` function for returning the raw bytes.
Fixes#1316.
* Allocated `SocketAddrUnix::path()` with correct length (#1372)
Using `.to_owned()` + `.push()` will cause a reallocation, because the
initially allocated array with be one byte too short.
We can use `CString::from_vec_with_nul_unchecked()` because it is a
known invariant that the input does not contain any `NUL`s, not even the
terminating `NUL`.
---------
Co-authored-by: René Kijewski <Kijewski@users.noreply.github.com>
0 commit comments