]> granicus.if.org Git - neomutt/commitdiff
Make sort by "To" stable (closes #2515).
authorUnknown <pywatson@gmail.com>
Tue, 5 Jun 2007 20:12:05 +0000 (13:12 -0700)
committerUnknown <pywatson@gmail.com>
Tue, 5 Jun 2007 20:12:05 +0000 (13:12 -0700)
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.

ChangeLog
sort.c

index 9e4e5d9c53dc5edfd894b1aeb97d333592dbb027..aea6b892bbf85fac8d7b425aa6b1bf3467d16c20 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-05-17 14:40 +0200  Christoph Berg  <cb@df7cb.de>  (edefe5e1f2b4)
+
+       * Muttrc.head: Temporarily set pipe_decode in the \cb urlview macro.
+       (Debian #423640.)
+
+2007-05-28 16:44 -0700  Brendan Cully  <brendan@kublai.com>  (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  <brendan@kublai.com>  (a0e038310f42)
 
        * smtp.c: Forget SMTP password if authentication fails.  Thanks to
diff --git a/sort.c b/sort.c
index 48a5b312025307f402acf34b82c30e22c06d9f55..c9e7137ed6bcc2f6f6238f7352210ba61ec23bee 100644 (file)
--- 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));
 }