mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-05 21:07:41 +03:00
Fix invalid address check in UoT conn
This commit is contained in:
parent
49f5dfd767
commit
570295cd12
1 changed files with 8 additions and 2 deletions
|
@ -78,7 +78,10 @@ func (c *Conn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
|||
buffer := buf.NewSize(bufferLen)
|
||||
defer buffer.Release()
|
||||
if !c.isConnect {
|
||||
common.Must(AddrParser.WriteAddrPort(buffer, destination))
|
||||
err = AddrParser.WriteAddrPort(buffer, destination)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
common.Must(binary.Write(buffer, binary.BigEndian, uint16(len(p))))
|
||||
if c.writer == nil {
|
||||
|
@ -125,7 +128,10 @@ func (c *Conn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error {
|
|||
header := buf.NewSize(headerLen)
|
||||
defer header.Release()
|
||||
if !c.isConnect {
|
||||
common.Must(AddrParser.WriteAddrPort(header, destination))
|
||||
err := AddrParser.WriteAddrPort(header, destination)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
common.Must(binary.Write(header, binary.BigEndian, uint16(buffer.Len())))
|
||||
if c.writer == nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue