[Fixed] The array may be sent out of bounds

This commit is contained in:
gVisor bot 2021-12-09 22:51:18 +08:00
parent a7b3d928f9
commit c9001cc60c

View file

@ -86,5 +86,7 @@ func (session Session) AllocateSendPacket(packetSize int) (packet []byte, err er
}
func (session Session) SendPacket(packet []byte) {
syscall.Syscall(procWintunSendPacket.Addr(), 2, session.handle, uintptr(unsafe.Pointer(&packet[0])), 0)
if packet != nil && len(packet) > 0 {
syscall.Syscall(procWintunSendPacket.Addr(), 2, session.handle, uintptr(unsafe.Pointer(&packet[0])), 0)
}
}