unix: allow to bind unix sockets only to AF_UNIX addresses

Reported-by: syzbot+2c0bcfd87fb4e8b7b009@syzkaller.appspotmail.com
PiperOrigin-RevId: 285228312
This commit is contained in:
Andrei Vagin
2019-12-12 11:08:56 -08:00
committed by gVisor bot
parent b9aa62b9f9
commit 378d6c1f36
3 changed files with 19 additions and 1 deletions
+1 -1
View File
@@ -326,7 +326,7 @@ func AddressAndFamily(sfamily int, addr []byte, strict bool) (tcpip.FullAddress,
}
family := usermem.ByteOrder.Uint16(addr)
if family != uint16(sfamily) && (!strict && family != linux.AF_UNSPEC) {
if family != uint16(sfamily) && (strict || family != linux.AF_UNSPEC) {
return tcpip.FullAddress{}, family, syserr.ErrAddressFamilyNotSupported
}