changeset 24526:f3103f786c86

Prevent a NULL printf crash. This probably wont actually ever authenticate successfully in the situation where it would have crashed, but at least it wont crash. Fixes #7526
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 24 Nov 2008 03:23:25 +0000
parents 1ee0ded8926b
children 1b61f62e5240 adf153852bcf
files libpurple/proxy.c
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/proxy.c	Mon Nov 24 00:52:41 2008 +0000
+++ b/libpurple/proxy.c	Mon Nov 24 03:23:25 2008 +0000
@@ -944,12 +944,15 @@
 
 			} else if((header = g_strrstr((const char *)connect_data->read_buffer, "Proxy-Authenticate: Basic"))) {
 				gchar *t1, *t2;
+				const char *username, *password;
+
+				username = purple_proxy_info_get_username(connect_data->gpi);
+				password = purple_proxy_info_get_password(connect_data->gpi);
 
 				t1 = g_strdup_printf("%s:%s",
-					purple_proxy_info_get_username(connect_data->gpi),
-					purple_proxy_info_get_password(connect_data->gpi) ?
-					purple_proxy_info_get_password(connect_data->gpi) : "");
-				t2 = purple_base64_encode((const guchar *)t1, strlen(t1));
+									 username ? username : "",
+									 password ? password : "");
+				t2 = purple_base64_encode((guchar *)t1, strlen(t1));
 				g_free(t1);
 
 				request = g_strdup_printf(