Skip to content

Commit 5ca0f36

Browse files
authored
generate alert instead of panic when encountering incorrect listen on port 0 on IPv4 or v6 address (v2fly#3172)
1 parent b921dca commit 5ca0f36

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

transport/internet/transportcommon/listener.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ func ListenWithSecuritySettings(ctx context.Context, address net.Address, port n
2121
transportListener := transportEnvironment.Listener()
2222

2323
if port == net.Port(0) { // unix
24+
if !address.Family().IsDomain() {
25+
return nil, newError("invalid address for unix domain socket: ", address)
26+
}
2427
listener, err := transportListener.Listen(ctx, &net.UnixAddr{
2528
Name: address.Domain(),
2629
Net: "unix",

0 commit comments

Comments
 (0)