aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-11-30 04:02:09 +0800
committerDan Winship <danw@src.gnome.org>2000-11-30 04:02:09 +0800
commit292dd96540823a9e7969701c95341eada2ce16f6 (patch)
tree10205e4fdbefd2e7fa8f1188c69940f4d2d11d67 /mail
parentcb5a1deee0c9cb099fdf5d561018febbc3c294df (diff)
downloadgsoc2013-evolution-292dd96540823a9e7969701c95341eada2ce16f6.tar
gsoc2013-evolution-292dd96540823a9e7969701c95341eada2ce16f6.tar.gz
gsoc2013-evolution-292dd96540823a9e7969701c95341eada2ce16f6.tar.bz2
gsoc2013-evolution-292dd96540823a9e7969701c95341eada2ce16f6.tar.lz
gsoc2013-evolution-292dd96540823a9e7969701c95341eada2ce16f6.tar.xz
gsoc2013-evolution-292dd96540823a9e7969701c95341eada2ce16f6.tar.zst
gsoc2013-evolution-292dd96540823a9e7969701c95341eada2ce16f6.zip
Fix the allocation here (again) and put a comment explaining it. (Fixes a
* mail-tools.c (mail_tool_quote_message): Fix the allocation here (again) and put a comment explaining it. (Fixes a crash when replying.) svn path=/trunk/; revision=6717
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog6
-rw-r--r--mail/mail-tools.c9
2 files changed, 14 insertions, 1 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 623c52a8bd..6baf2c75d3 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,9 @@
+2000-11-29 Dan Winship <danw@helixcode.com>
+
+ * mail-tools.c (mail_tool_quote_message): Fix the allocation here
+ (again) and put a comment explaining it. (Fixes a crash when
+ replying.)
+
2000-11-28 Dan Winship <danw@helixcode.com>
* component-factory.c (owner_set_cb): Wait until after setting up
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index b56ef33750..20006ce317 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -589,7 +589,14 @@ mail_tool_quote_message (CamelMimeMessage *message, const char *fmt, ...)
lines++;
offset = credits ? strlen (credits) : 0;
- quoted_text = g_malloc (offset + strlen (text) + lines * 2);
+
+ /* offset is the size of the credits, strlen (text)
+ * covers the body, lines * 2 does the "> "s, and
+ * the last +2 covers the final "\0", plus an extra
+ * "\n" in case text doesn't end with one.
+ */
+ quoted_text = g_malloc (offset + strlen (text) +
+ lines * 2 + 2);
if (credits)
memcpy (quoted_text, credits, offset);