mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-02-26 16:57:08 +00:00
fix: handle nil pointer stored in non-nil interface (#2337)
This commit is contained in:
@@ -252,13 +252,14 @@ func (spc *ssrPacketConn) WaitReadFrom() (data []byte, put func(), addr net.Addr
|
||||
return nil, nil, nil, errors.New("parse addr error")
|
||||
}
|
||||
|
||||
addr = _addr.UDPAddr()
|
||||
if addr == nil {
|
||||
udpAddr := _addr.UDPAddr()
|
||||
if udpAddr == nil {
|
||||
if put != nil {
|
||||
put()
|
||||
}
|
||||
return nil, nil, nil, errors.New("parse addr error")
|
||||
}
|
||||
addr = udpAddr
|
||||
|
||||
data = data[len(_addr):]
|
||||
return
|
||||
|
||||
@@ -183,7 +183,11 @@ func (pc *PacketConn) WaitReadFrom() (data []byte, put func(), addr net.Addr, er
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
addr = destination.UDPAddr()
|
||||
udpAddr := destination.UDPAddr()
|
||||
if udpAddr == nil {
|
||||
return nil, nil, nil, errors.New("parse addr error")
|
||||
}
|
||||
addr = udpAddr
|
||||
|
||||
data = pool.Get(pool.UDPBufferSize)
|
||||
put = func() {
|
||||
|
||||
Reference in New Issue
Block a user