Skip to content

Commit

Permalink
Patch for unexpected scenario
Browse files Browse the repository at this point in the history
Fix #4
  • Loading branch information
superfashi committed Jan 26, 2017
1 parent 001ec15 commit 08674cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion socks4.go
Expand Up @@ -131,7 +131,7 @@ func (s *Socks4Client) Dial(network, address string) (net.Conn, error) {
if buff[1] != socks4Granted {
cd := int(buff[1]) - socks4Granted
failure := "unknown error"
if cd < len(socks4Errors) {
if cd < len(socks4Errors) && cd >= 0 {
failure = socks4Errors[cd]
}
return nil, errors.New("socks: SOCKS4 server at " + s.address + " failed to connect: " + failure)
Expand Down

0 comments on commit 08674cc

Please sign in to comment.