changeset 4681:cc110cb8c56b HEAD

Filter out "From " lines from headers. There's no reason they should exist in there and they'll cause problems.
author Timo Sirainen <tss@iki.fi>
date Sun, 15 Oct 2006 18:42:58 +0300
parents cd2db88396e1
children bc071307fc2a
files src/lib-storage/index/mbox/mbox-save.c
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-save.c	Sun Oct 15 18:11:34 2006 +0300
+++ b/src/lib-storage/index/mbox/mbox-save.c	Sun Oct 15 18:42:58 2006 +0300
@@ -326,8 +326,18 @@
 {
 	struct mbox_save_context *ctx = context;
 
-	if (!*matched && ctx->mbox_md5_ctx && hdr != NULL)
-		mbox_md5_continue(ctx->mbox_md5_ctx, hdr);
+	if (hdr != NULL) {
+		if (strncmp(hdr->name, "From ", 5) == 0) {
+			/* we can't allow From_-lines in headers. there's no
+			   legitimate reason for allowing them in any case,
+			   so just drop them. */
+			*matched = TRUE;
+			return;
+		}
+
+		if (!*matched && ctx->mbox_md5_ctx != NULL)
+			mbox_md5_continue(ctx->mbox_md5_ctx, hdr);
+	}
 
 	if ((hdr == NULL && ctx->eoh_input_offset == (uoff_t)-1) ||
 	    (hdr != NULL && hdr->eoh))