aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2022-01-28 14:57:44 +0000
committerEd Maste <emaste@FreeBSD.org>2022-02-05 16:26:42 +0000
commit5c1ee92b0ebab49577d065baf7f37a8ffcde4259 (patch)
tree057c3b6419eed3373646faf6f4614548570b9f99
parent647d3bf17cd907ded624dccf4fe4567924c4f399 (diff)
dma: limit lines to 998 characters
Per RFC2822 the maximum transmitted line length is "998 characters... excluding the CRLF." In a file the maximum is 999 with the \n included. Previously mail containing a line with exactly 999 characters would bounce. PR: 208261 Reported by: Helge Oldach MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit 1a0dde338df8b493d74dcb2f7bbaaa6c02cab371)
-rw-r--r--contrib/dma/mail.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/dma/mail.c b/contrib/dma/mail.c
index 48c8ee6d4dd2..9e00c22d71db 100644
--- a/contrib/dma/mail.c
+++ b/contrib/dma/mail.c
@@ -43,7 +43,7 @@
#include "dma.h"
-#define MAX_LINE_RFC822 1000
+#define MAX_LINE_RFC822 999 /* 998 characters plus \n */
void
bounce(struct qitem *it, const char *reason)
@@ -378,7 +378,7 @@ readmail(struct queue *queue, int nodot, int recp_from_header)
char *line = NULL;
ssize_t linelen;
size_t linecap = 0;
- char newline[MAX_LINE_RFC822];
+ char newline[MAX_LINE_RFC822 + 1];
size_t error;
int had_headers = 0;
int had_from = 0;