1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix(ext/net): should not panic when listening to unix abstract address (#12300)

This commit is contained in:
Ahab 2021-10-03 01:09:59 +08:00 committed by GitHub
parent 21520f5ff1
commit 198f5b9514
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View file

@ -625,3 +625,18 @@ unitTest(
listener.close();
},
);
unitTest(
{
ignore: Deno.build.os !== "linux",
permissions: { read: true, write: true },
},
function netUnixAbstractPathShouldNotPanic() {
const listener = Deno.listen({
path: "\0aaa",
transport: "unix",
});
assert("not panic");
listener.close();
},
);

View file

@ -518,11 +518,7 @@ where
} else {
net_unix::listen_unix_packet(state, address_path)?
};
debug!(
"New listener {} {}",
rid,
local_addr.as_pathname().unwrap().display(),
);
debug!("New listener {} {:?}", rid, local_addr);
let unix_addr = net_unix::UnixAddr {
path: local_addr.as_pathname().and_then(net_unix::pathstring),
};