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
This commit is contained in:
Ed Maste 2022-01-28 09:57:44 -05:00
parent 4bd030b369
commit 1a0dde338d

View File

@ -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;