aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-account-editor.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2008-05-19 23:44:20 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-05-19 23:44:20 +0800
commitd57e1802891a37ffd4bb212e2022614487fb4369 (patch)
tree5ff47c5bfbd2d52a268a1055f3a7ceb8de723b3b /mail/em-account-editor.c
parent7ea3da7607895f327690fdd03ec4608677ec62b4 (diff)
downloadgsoc2013-evolution-d57e1802891a37ffd4bb212e2022614487fb4369.tar.gz
gsoc2013-evolution-d57e1802891a37ffd4bb212e2022614487fb4369.tar.zst
gsoc2013-evolution-d57e1802891a37ffd4bb212e2022614487fb4369.zip
** Fixes bug #533465, patch from Ritesh Khadgaray
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. svn path=/trunk/; revision=35511
Diffstat (limited to 'mail/em-account-editor.c')
-rw-r--r--mail/em-account-editor.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index b41fd7d356..863faacc75 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -1025,15 +1025,18 @@ emae_url_set_hostport(CamelURL *url, const char *txt)
/* 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.