UDS: Check address before listen (#4945)

Fixes https://github.com/XTLS/Xray-core/issues/4944
pull/4980/head
风扇滑翔翼 2025-08-03 19:02:55 +08:00 committed by GitHub
parent 00f3147242
commit d4f11e6d68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -42,6 +42,9 @@ func ListenTCP(ctx context.Context, address net.Address, port net.Port, streamSe
var listener net.Listener
var err error
if port == net.Port(0) { // unix
if !address.Family().IsDomain() {
return nil, errors.New("invalid unix listen: ", address).AtError()
}
listener, err = internet.ListenSystem(ctx, &net.UnixAddr{
Name: address.Domain(),
Net: "unix",