Check for valid nfds before copying in an fd set.

Otherwise, CopyInFDSet will try to allocate a negative-length slice.

PiperOrigin-RevId: 286584907
This commit is contained in:
Dean Deng
2019-12-20 08:44:53 -08:00
committed by gVisor bot
parent 29955a4797
commit 822d847cca
+3
View File
@@ -36,6 +36,9 @@ func fdsFromSet(t *kernel.Task, set []byte) []int {
}
func fdSet(t *kernel.Task, nfds int, addr usermem.Addr) string {
if nfds < 0 {
return fmt.Sprintf("%#x (negative nfds)", addr)
}
if addr == 0 {
return "null"
}