[Fixed] The array may be sent out of bounds

This commit is contained in:
Skyxim 2021-12-09 22:51:18 +08:00
parent 7d17d53a8f
commit e92ef587bb

View file

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