Browse Source

Fix: potential crash by bad UDP address (#238)

pull/248/head
xjasonlyu 2 years ago
parent
commit
195290884c
  1. 4
      proxy/socks5.go

4
proxy/socks5.go

@ -121,6 +121,10 @@ func (ss *Socks5) DialUDP(*M.Metadata) (_ net.PacketConn, err error) {
}() }()
bindAddr := addr.UDPAddr() bindAddr := addr.UDPAddr()
if bindAddr == nil {
return nil, fmt.Errorf("invalid UDP binding address: %#v", addr)
}
if bindAddr.IP.IsUnspecified() { /* e.g. "0.0.0.0" or "::" */ if bindAddr.IP.IsUnspecified() { /* e.g. "0.0.0.0" or "::" */
udpAddr, err := net.ResolveUDPAddr("udp", ss.Addr()) udpAddr, err := net.ResolveUDPAddr("udp", ss.Addr())
if err != nil { if err != nil {

Loading…
Cancel
Save