From: Unknown Date: Tue, 5 Jun 2007 20:12:05 +0000 (-0700) Subject: Make sort by "To" stable (closes #2515). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d4b5bb20ab8fc9e01b6172b8de0df0f3b4d30ef1;p=neomutt Make sort by "To" stable (closes #2515). compare_to() calls mutt_get_name(), which may return a static pointer if it in turn calls mutt_addr_for_display(). If this static pointer is used for a and b, the result is bad. The fix is to make a copy of the first object. --- diff --git a/ChangeLog b/ChangeLog index 9e4e5d9c5..aea6b892b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-05-17 14:40 +0200 Christoph Berg (edefe5e1f2b4) + + * Muttrc.head: Temporarily set pipe_decode in the \cb urlview macro. + (Debian #423640.) + +2007-05-28 16:44 -0700 Brendan Cully (794b039bacaa) + + * Makefile.am, configure.ac, hcachever.sh, hcachever.sh.in: + Use autoconf instead of "which" to discover MD5 tool + 2007-05-20 00:29 -0700 Brendan Cully (a0e038310f42) * smtp.c: Forget SMTP password if authentication fails. Thanks to diff --git a/sort.c b/sort.c index 48a5b3120..c9e7137ed 100644 --- a/sort.c +++ b/sort.c @@ -114,9 +114,10 @@ int compare_to (const void *a, const void *b) const char *fa, *fb; int result; - fa = mutt_get_name ((*ppa)->env->to); + fa = safe_strdup (mutt_get_name ((*ppa)->env->to)); fb = mutt_get_name ((*ppb)->env->to); result = mutt_strcasecmp (fa, fb); + FREE(&fa); AUXSORT(result,a,b); return (SORTCODE (result)); } @@ -128,9 +129,10 @@ int compare_from (const void *a, const void *b) const char *fa, *fb; int result; - fa = mutt_get_name ((*ppa)->env->from); + fa = safe_strdup (mutt_get_name ((*ppa)->env->from)); fb = mutt_get_name ((*ppb)->env->from); result = mutt_strcasecmp (fa, fb); + FREE(&fa); AUXSORT(result,a,b); return (SORTCODE (result)); }