pidgin: b57781a5: Fix SOCK5 error handling to abort when w...

datallah at pidgin.im datallah at pidgin.im
Mon May 19 23:56:05 EDT 2008


-----------------------------------------------------------------
Revision: b57781a52511d0ab7a57590bf5c348f3b9d05640
Ancestor: e9fa06c5d654248927dd0838d27cfb6b712a153a
Author: datallah at pidgin.im
Date: 2008-05-20T03:50:26
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/b57781a52511d0ab7a57590bf5c348f3b9d05640

Modified files:
        libpurple/proxy.c

ChangeLog: 

Fix SOCK5 error handling to abort when we get a bogus ATYP response.  Make the
initial buffer size big enough to read the address length for DOMAINNAME
addresses. References #5840.

-------------- next part --------------
============================================================
--- libpurple/proxy.c	cc69174d8b54624c4501260d0fd2bd5a5f87379e
+++ libpurple/proxy.c	5cb7ec6c3379d7a141cf160882514cda8aca8262
@@ -1145,7 +1145,7 @@ s5_canread_again(gpointer data, gint sou
 	int len;
 
 	if (connect_data->read_buffer == NULL) {
-		connect_data->read_buf_len = 4;
+		connect_data->read_buf_len = 5;
 		connect_data->read_buffer = g_malloc(connect_data->read_buf_len);
 		connect_data->read_len = 0;
 	}
@@ -1214,6 +1214,11 @@ s5_canread_again(gpointer data, gint sou
 				return;
 			buf += 4 + 16;
 			break;
+		default:
+			purple_debug_error("socks5 proxy", "Invalid ATYP received (0x%X)\n", buf[3]);
+			purple_proxy_connect_data_disconnect(connect_data,
+					_("Received invalid data on connection with server."));
+			return;
 	}
 
 	/* Skip past BND.PORT */


More information about the Commits mailing list