Check socksaddr domain is valid

This commit is contained in:
世界 2022-09-13 19:50:00 +08:00
parent 27ddefbb89
commit a606585cf7
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
3 changed files with 8 additions and 3 deletions

View file

@ -53,8 +53,8 @@ func (c *ClientConn) Write(p []byte) (n int, err error) {
}
func (c *ClientConn) WriteBuffer(buffer *buf.Buffer) error {
defer buffer.Release()
if c.headerWritten {
defer buffer.Release()
return common.Error(c.Conn.Write(buffer.Bytes()))
}
err := ClientHandshakeBuffer(c.Conn, c.key, c.destination, buffer)
@ -105,7 +105,6 @@ func (c *ClientPacketConn) ReadPacket(buffer *buf.Buffer) (M.Socksaddr, error) {
}
func (c *ClientPacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error {
defer buffer.Release()
if !c.headerWritten {
err := ClientHandshakePacket(c.Conn, c.key, destination, buffer)
c.headerWritten = true