mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-23 16:53:25 +08:00
deep clone slice with copy
This commit is contained in:
@@ -232,7 +232,8 @@ func DecodeUDPPacket(packet []byte) (addr Addr, payload []byte, err error) {
|
||||
err = errors.New("failed to read UDP header")
|
||||
}
|
||||
|
||||
payload = bytes.Join([][]byte{packet[3+len(addr):]}, []byte{})
|
||||
payload = make([]byte, len(packet[3+len(addr):]))
|
||||
copy(payload, packet[3+len(addr):])
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user