mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
fix checking number of arg before accessing it
This commit is contained in:
parent
c0acdd7d2a
commit
15189aa5ac
1 changed files with 3 additions and 0 deletions
|
@ -244,6 +244,9 @@ func (handler *httpHandler) turboTunnelUDPLikeMode(conn net.Conn, addr net.Addr,
|
||||||
|
|
||||||
clientID := turbotunnel.ClientID{}
|
clientID := turbotunnel.ClientID{}
|
||||||
compoments := strings.Split(protocol, " ")
|
compoments := strings.Split(protocol, " ")
|
||||||
|
if len(compoments) != 2 {
|
||||||
|
return fmt.Errorf("invalid protocol: %s", protocol)
|
||||||
|
}
|
||||||
_, err := hex.Decode(clientID[:], []byte(compoments[1]))
|
_, err := hex.Decode(clientID[:], []byte(compoments[1]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("reading ClientID: %v", err)
|
return fmt.Errorf("reading ClientID: %v", err)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue