changeset 20973:3e10bdc691d2

Prevent a crash when the proxy username isn't specified. Fixes #3583.
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 16 Oct 2007 17:09:51 +0000
parents 6b9c49ae774c
children 365d000295d5
files libpurple/proxy.c
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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,