From 28c50b7cb8dfb17659c6043c48d5cc03be537154 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Sat, 23 Sep 2000 14:29:35 +0000 Subject: Fix a crash that happened on my system when sorting by the "From" field. (The address parsing code failed miserably if the first character was a space.) svn path=/trunk/; revision=5559 --- mail/ChangeLog | 7 +++++++ mail/message-list.c | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 09264e2616..b04ad0d151 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,10 @@ +2000-09-23 Ettore Perazzoli + + * message-list.c (internet_address_new_from_string): Skip spaces + at the beginning of the string first before doing anything else. + The code that follows doesn't like the first character of the + string to be a space. + 2000-09-22 Jeffrey Stedfast * message-list.c (address_compare): New comparison function for diff --git a/mail/message-list.c b/mail/message-list.c index e0694cbc6b..4fc773e77e 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -124,15 +124,22 @@ internet_address_new_from_string (const gchar *string) */ InternetAddress *ia; gchar *name = NULL, *address = NULL; - gchar *ptr, *padding = NULL; + const gchar *ptr; + const gchar *padding; gboolean in_quotes = FALSE; gboolean name_first = FALSE; g_return_val_if_fail (string != NULL, NULL); g_return_val_if_fail (*string != '\0', NULL); + + padding = NULL; + + ptr = string; + while (isspace (*ptr)) + ptr++; /* look for padding between parts... */ - for (ptr = (gchar *) string; *ptr; ptr++) { + for (; *ptr; ptr++) { if (*ptr == '"') { in_quotes = !in_quotes; name_first = TRUE; -- cgit