From c9001cc60c2b1b395c3a4f77193d2f0cc7801c7f Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Thu, 9 Dec 2021 22:51:18 +0800 Subject: [PATCH] [Fixed] The array may be sent out of bounds --- listener/tun/dev/wintun/session_windows.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/listener/tun/dev/wintun/session_windows.go b/listener/tun/dev/wintun/session_windows.go index f023baf7..11081158 100644 --- a/listener/tun/dev/wintun/session_windows.go +++ b/listener/tun/dev/wintun/session_windows.go @@ -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) + } }