diff libpurple/proxy.c @ 30185:9e60e300541a

Fix an invalid memory deref with Windows proxy settings when there's no ":port" Patch from Marten Klencke. Closes #11701. committer: Paul Aurich <paul@darkrain42.org>
author mklencke@gmx.net
date Thu, 22 Apr 2010 03:09:15 +0000
parents 0257b8fe21d6
children 7c871249318b
line wrap: on
line diff
--- a/libpurple/proxy.c	Wed Apr 21 19:07:19 2010 +0000
+++ b/libpurple/proxy.c	Thu Apr 22 03:09:15 2010 +0000
@@ -379,11 +379,16 @@
 	char *d;
 
 	d = g_strrstr(host, ":");
-	if (d)
+	if (d) {
 		*d = '\0';
-	d++;
-	if (*d)
-		sscanf(d, "%d", &port);
+
+		d++;
+		if (*d)
+			sscanf(d, "%d", &port);
+
+		if (port == 0)
+			port = default_port;
+	}
 
 	purple_proxy_info_set_host(info, host);
 	purple_proxy_info_set_port(info, port);