mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-10 02:50:27 +00:00
Fix panic where slice goes out of bounds because iface.Read returns less than zero (which might happen when the TUN/TAP interface is closed)
This commit is contained in:
parent
368f499f1d
commit
94cf2854a9
@ -111,7 +111,7 @@ func (r *tunReader) _read() {
|
||||
recvd := util.ResizeBytes(util.GetBytes(), 65535+tun_ETHER_HEADER_LENGTH)
|
||||
// Wait for a packet to be delivered to us through the TUN/TAP adapter
|
||||
n, err := r.tun.iface.Read(recvd)
|
||||
if n == 0 {
|
||||
if n <= 0 {
|
||||
util.PutBytes(recvd)
|
||||
} else {
|
||||
r.tun.handlePacketFrom(r, recvd[:n], err)
|
||||
|
Loading…
Reference in New Issue
Block a user