From: Fabian Keil <fk@fabiankeil.de>
Date: Tue, 25 Oct 2016 10:45:56 +0000 (+0000)
Subject: socks5_connect(): Fail in case of unsupported address types
X-Git-Tag: v_3_0_27~263
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/faq/@default-cgi@/static/@default-cgi@show-url-info?a=commitdiff_plain;h=fd252e59670de25103fa48f61acf8e25f3ab1b07;p=privoxy.git

socks5_connect(): Fail in case of unsupported address types

Previously they would not be detected right away and
Privoxy would fail later on with an error message that
didn't make it obvious that the problem was socks-related.

So far, no such problems have actually been reported.
---

diff --git a/gateway.c b/gateway.c
index 304ecd49..67d878e1 100644
--- a/gateway.c
+++ b/gateway.c
@@ -1,4 +1,4 @@
-const char gateway_rcs[] = "$Id: gateway.c,v 1.96 2016/01/16 12:30:43 fabiankeil Exp $";
+const char gateway_rcs[] = "$Id: gateway.c,v 1.97 2016/10/25 10:43:00 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/gateway.c,v $
@@ -1172,6 +1172,10 @@ static jb_socket socks5_connect(const struct forward_spec *fwd,
                errstr = "SOCKS5 negotiation read failed (IPv6 address)";
             }
          }
+         else if (sbuf[3] != '\x01')
+         {
+             errstr = "SOCKS5 reply contains unsupported address type";
+         }
          if (errstr == NULL)
          {
             return(sfd);