From e92ef587bb00186f3fe198d1be0cbb98f2e1d4fc Mon Sep 17 00:00:00 2001 From: Skyxim 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) + } }