Fix: socks address stringify buffer overflow
This commit is contained in:
parent
6f3a654d6c
commit
48a2013d9c
1 changed files with 3 additions and 2 deletions
|
@ -48,8 +48,9 @@ func (a Addr) String() string {
|
||||||
|
|
||||||
switch a[0] {
|
switch a[0] {
|
||||||
case AtypDomainName:
|
case AtypDomainName:
|
||||||
host = string(a[2 : 2+int(a[1])])
|
hostLen := uint16(a[1])
|
||||||
port = strconv.Itoa((int(a[2+int(a[1])]) << 8) | int(a[2+int(a[1])+1]))
|
host = string(a[2 : 2+hostLen])
|
||||||
|
port = strconv.Itoa((int(a[2+hostLen]) << 8) | int(a[2+hostLen+1]))
|
||||||
case AtypIPv4:
|
case AtypIPv4:
|
||||||
host = net.IP(a[1 : 1+net.IPv4len]).String()
|
host = net.IP(a[1 : 1+net.IPv4len]).String()
|
||||||
port = strconv.Itoa((int(a[1+net.IPv4len]) << 8) | int(a[1+net.IPv4len+1]))
|
port = strconv.Itoa((int(a[1+net.IPv4len]) << 8) | int(a[1+net.IPv4len+1]))
|
||||||
|
|
Loading…
Reference in a new issue