diff mail.c @ 5:d163044ae493

Fix off-by-one memory allocation error (part II)
author Adam Chlipala <adam@chlipala.net>
date Sat, 26 Dec 2015 14:15:54 -0500
parents 0420bfe96dda
children f96ca37be746
line wrap: on
line diff
--- a/mail.c	Sat Dec 26 14:15:12 2015 -0500
+++ b/mail.c	Sat Dec 26 14:15:54 2015 -0500
@@ -93,7 +93,7 @@
 
   address(ctx, s);
   if (h2->cc) {
-    uw_Basis_string all = uw_malloc(ctx, strlen(h2->cc) + 1 + strlen(s));
+    uw_Basis_string all = uw_malloc(ctx, strlen(h2->cc) + 2 + strlen(s));
     sprintf(all, "%s,%s", h2->cc, s);
     h2->cc = all;
   } else
@@ -111,7 +111,7 @@
 
   address(ctx, s);
   if (h2->bcc) {
-    uw_Basis_string all = uw_malloc(ctx, strlen(h2->bcc) + 1 + strlen(s));
+    uw_Basis_string all = uw_malloc(ctx, strlen(h2->bcc) + 2 + strlen(s));
     sprintf(all, "%s,%s", h2->bcc, s);
     h2->bcc = all;
   } else