Prevent a crash when the proxy username isn't specified. Fixes #3583.

Tue, 16 Oct 2007 17:09:51 +0000

author
Daniel Atallah <datallah@pidgin.im>
date
Tue, 16 Oct 2007 17:09:51 +0000
changeset 21049
ebef27a41c9a
parent 21048
2c2d4d84d329
child 21050
e637c0898829

Prevent a crash when the proxy username isn't specified. Fixes #3583.

libpurple/proxy.c file | annotate | diff | comparison | revisions
--- a/libpurple/proxy.c	Tue Oct 16 08:01:45 2007 +0000
+++ b/libpurple/proxy.c	Tue Oct 16 17:09:51 2007 +0000
@@ -690,11 +690,12 @@
 				gchar *tmp = ntlm;
 				guint8 *nonce;
 				gchar *domain = (gchar*)purple_proxy_info_get_username(connect_data->gpi);
-				gchar *username;
+				gchar *username = NULL;
 				gchar *request;
 				gchar *response;
 
-				username = strchr(domain, '\\');
+				if (domain != NULL)
+					username = strchr(domain, '\\');
 				if (username == NULL)
 				{
 					purple_proxy_connect_data_disconnect_formatted(connect_data,
@@ -738,9 +739,11 @@
 			} else if((ntlm = g_strrstr((const char *)connect_data->read_buffer, "Proxy-Authenticate: NTLM"))) { /* Empty message */
 				gchar request[2048];
 				gchar *domain = (gchar*) purple_proxy_info_get_username(connect_data->gpi);
-				gchar *username;
+				gchar *username = NULL;
 				int request_len;
-				username = strchr(domain, '\\');
+
+				if (domain != NULL)
+					username = strchr(domain, '\\');
 				if (username == NULL)
 				{
 					purple_proxy_connect_data_disconnect_formatted(connect_data,

mercurial