summaryrefslogtreecommitdiffhomepage
path: root/tun
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-02-20 18:38:18 +0100
committerSimon Rozman <simon@rozman.si>2019-02-20 18:38:18 +0100
commit040da43889d0c3a08dc4469cb128b9f8015a78f8 (patch)
treed6215cc2c9bfccb9b4ba8e2c3e615347e49938d5 /tun
parentb7025b56274f65080d3c20a34a35ec5a07422792 (diff)
wintun: Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'tun')
-rw-r--r--tun/tun_windows.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/tun/tun_windows.go b/tun/tun_windows.go
index 5a4103d..5f9c0f4 100644
--- a/tun/tun_windows.go
+++ b/tun/tun_windows.go
@@ -239,7 +239,7 @@ func (tun *nativeTun) Read(buff []byte, offset int) (int, error) {
}
// Copy data.
- copy(buff[offset:], (*(*[packetSizeMax]byte)(unsafe.Pointer(&tun.rdBuff.data[tun.rdBuff.offset+4])))[:size])
+ copy(buff[offset:], tun.rdBuff.data[tun.rdBuff.offset+4:][:size])
tun.rdBuff.offset += pSize
return int(size), nil
}
@@ -331,7 +331,7 @@ func (tun *nativeTun) putTunPacket(buff []byte) error {
// Write packet to the exchange buffer.
*(*uint32)(unsafe.Pointer(&tun.wrBuff.data[tun.wrBuff.offset])) = size
- copy((*(*[packetSizeMax]byte)(unsafe.Pointer(&tun.wrBuff.data[tun.wrBuff.offset+4])))[:size], buff)
+ copy(tun.wrBuff.data[tun.wrBuff.offset+4:][:size], buff)
tun.wrBuff.packetNum++
tun.wrBuff.offset += pSize