talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 3ae395b7c893fe8e535708ae0a46295d52c7f978
parent d07722d7d00132463f5a86266c22140a69aa477a
Author: Ricardo Mones <ricardo@mones.org>
Date:   Mon, 28 Oct 2013 09:39:35 +0100

Fix segfault for addresses without name part

Thanks Paul for reporting on irc ;-)

Diffstat:
Msrc/compose.c | 22++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/compose.c b/src/compose.c @@ -6138,16 +6138,18 @@ static gchar *compose_quote_list_of_addresses(gchar *str) for (item = list; item != NULL; item = item->next) { gchar *spec = item->data; gchar *endofname = strstr(spec, " <"); - *endofname = '\0'; - QUOTE_IF_REQUIRED_NORMAL(qname, spec, return NULL); - *endofname = ' '; - if (*qname != *spec) { /* has been quoted, compute new */ - gchar *addr = g_strdup(endofname); - gchar *name = g_strdup(qname); - faddr = g_strconcat(name, addr, NULL); - g_free(name); - g_free(addr); - debug_print("new auto-quoted address: '%s'", faddr); + if (endofname != NULL) { + *endofname = '\0'; + QUOTE_IF_REQUIRED_NORMAL(qname, spec, return NULL); + *endofname = ' '; + if (*qname != *spec) { /* has been quoted, compute new */ + gchar *addr = g_strdup(endofname); + gchar *name = g_strdup(qname); + faddr = g_strconcat(name, addr, NULL); + g_free(name); + g_free(addr); + debug_print("new auto-quoted address: '%s'", faddr); + } } if (result == NULL) result = g_strdup((faddr != NULL)? faddr: spec);