fix: SA4001 for net.UDPAddr copy

This commit is contained in:
gVisor bot 2023-03-12 23:37:45 +08:00
parent dcccdaddaf
commit 6a2ac83da1

View File

@ -46,7 +46,8 @@ func handleUDPToLocal(packet C.UDPPacket, pc net.PacketConn, key string, oAddr,
}
fromUDPAddr := from.(*net.UDPAddr)
fromUDPAddr = &(*fromUDPAddr) // make a copy
_fromUDPAddr := *fromUDPAddr
fromUDPAddr = &_fromUDPAddr // make a copy
if fromAddr, ok := netip.AddrFromSlice(fromUDPAddr.IP); ok {
if fAddr.IsValid() && (oAddr.Unmap() == fromAddr.Unmap()) {
fromUDPAddr.IP = fAddr.Unmap().AsSlice()