changeset 23010:d0f933c88fc6

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.
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 20 May 2008 03:50:26 +0000
parents 318905da6f8d
children c9592f5b3a52
files libpurple/proxy.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/proxy.c	Tue May 20 02:14:50 2008 +0000
+++ b/libpurple/proxy.c	Tue May 20 03:50:26 2008 +0000
@@ -1145,7 +1145,7 @@
 	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 @@
 				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 */