changeset 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 3ac7f10d13d4
children 06fa97f637a7 2140074fa387
files COPYRIGHT ChangeLog libpurple/proxy.c
diffstat 3 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Wed Apr 21 19:07:19 2010 +0000
+++ b/COPYRIGHT	Thu Apr 22 03:09:15 2010 +0000
@@ -245,6 +245,7 @@
 Jochen Kemnade
 Yann Kerherve
 Gordian Klein
+Marten Klencke
 Krzysztof Klinikowski
 Akuke Kok
 Kir Kolyshkin
--- a/ChangeLog	Wed Apr 21 19:07:19 2010 +0000
+++ b/ChangeLog	Thu Apr 22 03:09:15 2010 +0000
@@ -18,6 +18,8 @@
 	  GnuTLS manual for documentation on the format of the priority
 	  strings.
 	* Fix autoconf detection of Python.  (Brad Smith)
+	* Fix a crash when a Windows proxy (in IE) does not have a port.
+	  (Marten Klencke)
 
 	Pidgin:
 	* Moved the "Debugging Information" section of the About box to a
--- 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);