From a19484406c1cd545ff09dd1007350a7c87a523b2 Mon Sep 17 00:00:00 2001 From: Joey Schulze Date: Tue, 7 Feb 2006 18:27:06 +0000 Subject: [PATCH] Corrected handling of long header fields in compliance to section 2.2.3 of RFC 2822 --- mbox.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mbox.c b/mbox.c index 6385b92..0fc2491 100644 --- a/mbox.c +++ b/mbox.c @@ -37,6 +37,7 @@ struct mail { #define HDR_LEN 128 #define TAB 0x09 +#define LWSP 0x20 /* * Like strncpy() but with terminated result. @@ -182,7 +183,9 @@ int inspect_mbox(char *path, char *prefix, off_t size, int opt_flags) if (inheader && !feof(f)) { lookahead = fgetc(f); - if (lookahead == TAB) { + if (lookahead == TAB || lookahead == LWSP) { + if (buf[strlen(buf)-1] != LWSP) + strncat (buf, " ", sizeof(buf)-strlen(buf)-1); if ((cp = fgets(tmp, sizeof(tmp), f)) != NULL) { strncat (buf, tmp, sizeof(buf)-strlen(buf)-1); if (strlen(buf) > 0 && buf[strlen(buf)-1] == '\n') -- 2.20.1