summaryrefslogtreecommitdiffstats
path: root/copy.c
diff options
context:
space:
mode:
authorBrendan Cully <brendan@kublai.com>2005-07-24 08:59:44 +0000
committerBrendan Cully <brendan@kublai.com>2005-07-24 08:59:44 +0000
commitfe33d1e8ab61b21eeb0d899be818dec166db1f60 (patch)
treea4165331ee4d17241b9a7a24fef079ed0d87b90b /copy.c
parentb12887933ec039dd86759ba61b33df90381ae35d (diff)
Don't assume messages in MMDF mailboxes have From separators when copying them.
Spotted by William Lovas. Initial patch by TAKAHASHI Tamotsu.
Diffstat (limited to 'copy.c')
-rw-r--r--copy.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/copy.c b/copy.c
index 669de9ad..d1b3f7c2 100644
--- a/copy.c
+++ b/copy.c
@@ -701,10 +701,15 @@ int
_mutt_append_message (CONTEXT *dest, FILE *fpin, CONTEXT *src, HEADER *hdr,
BODY *body, int flags, int chflags)
{
+ char buf[STRING];
MESSAGE *msg;
int r;
- if ((msg = mx_open_new_message (dest, hdr, (src->magic == M_MBOX || src->magic == M_MMDF) ? 0 : M_ADD_FROM)) == NULL)
+ fseek(fpin, hdr->offset, 0);
+ if (fgets (buf, sizeof (buf), fpin) == NULL)
+ return -1;
+
+ if ((msg = mx_open_new_message (dest, hdr, is_from (buf, NULL, 0, NULL) ? 0 : M_ADD_FROM)) == NULL)
return -1;
if (dest->magic == M_MBOX || dest->magic == M_MMDF)
chflags |= CH_FROM | CH_FORCE_FROM;