evolution r35511 - trunk/mail



Author: mbarnes
Date: Mon May 19 15:44:20 2008
New Revision: 35511
URL: http://svn.gnome.org/viewvc/evolution?rev=35511&view=rev

Log:
2008-05-19  Matthew Barnes  <mbarnes redhat com>

	** Fixes bug #533465, patch from Ritesh Khadgaray

	* mail/em-account-editor.c (emae_url_set_hostport):
	Strip whitespace from user-entered hostname.



Modified:
   trunk/mail/ChangeLog
   trunk/mail/em-account-editor.c

Modified: trunk/mail/em-account-editor.c
==============================================================================
--- trunk/mail/em-account-editor.c	(original)
+++ trunk/mail/em-account-editor.c	Mon May 19 15:44:20 2008
@@ -1025,15 +1025,18 @@
 	/* FIXME: what if this was a raw IPv6 address? */
 	if (txt && (port = strchr(txt, ':'))) {
 		camel_url_set_port(url, atoi(port+1));
-		host = g_alloca(port-txt+1);
-		memcpy(host, txt, port-txt);
+		host = g_strdup(txt);
 		host[port-txt] = 0;
 	} else {
 		/* "" is converted to NULL, but if we set NULL on the url,
 		   camel_url_to_string strips lots of details */
-		host = (char *)(txt?txt:"");
+		host = g_strdup((txt?txt:""));
 	}
+
+	g_strstrip(host);
 	camel_url_set_host(url, host);
+
+	g_free(host);
 }
 
 /* This is used to map a funciton which will set on the url a string value.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]