zed-industries/zed · error · std::io::Error
paths may not contain interior null bytes
Error message
paths may not contain interior null bytes
What it means
The Unix-domain socket path contains a NUL byte, which cannot be represented in the fixed SOCKADDR_UN sun_path buffer (the address would be silently truncated). sockaddr_un rejects it as invalid input.
Source
Thrown at crates/net/src/util.rs:35
if result != 0 {
panic!("WSAStartup failed: {}", result);
}
});
}
// https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
pub(crate) fn sockaddr_un<P: AsRef<Path>>(path: P) -> Result<(SOCKADDR_UN, usize)> {
let mut addr = SOCKADDR_UN::default();
addr.sun_family = ADDRESS_FAMILY(AF_UNIX);
let bytes = path
.as_ref()
.to_str()
.map(|s| s.as_bytes())
.ok_or(ErrorKind::InvalidInput)?;
if bytes.contains(&0) {
return Err(Error::new(
ErrorKind::InvalidInput,
"paths may not contain interior null bytes",
));
}
if bytes.len() >= addr.sun_path.len() {
return Err(Error::new(
ErrorKind::InvalidInput,
"path must be shorter than SUN_LEN",
));
}
unsafe {
std::ptr::copy_nonoverlapping(
bytes.as_ptr(),
addr.sun_path.as_mut_ptr().cast(),
bytes.len(),
);
}View on GitHub (pinned to f4178619ac)
Solutions
- Reject or sanitize paths containing NUL bytes before creating sockets
- Use a shorter, clean path for the socket file
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/net/src/util.rs:35 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/0a1639ab514e2865.
Report an issue: GitHub.