View | Details | Raw Unified | Return to bug 208261 | Differences between
and this patch

Collapse All | Expand All

(-)contrib/dma/dma.h (+1 lines)
Lines 60-65 Link Here
60
#endif
60
#endif
61
#define	SMTP_PORT	25		/* Default SMTP port */
61
#define	SMTP_PORT	25		/* Default SMTP port */
62
#define CON_TIMEOUT	(5*60)		/* Connection timeout per RFC5321 */
62
#define CON_TIMEOUT	(5*60)		/* Connection timeout per RFC5321 */
63
#define MAX_LINE_RFC822	1000		/* Max line length per RFC822 */
63
64
64
#define STARTTLS	0x002		/* StartTLS support */
65
#define STARTTLS	0x002		/* StartTLS support */
65
#define SECURETRANS	0x004		/* SSL/TLS in general */
66
#define SECURETRANS	0x004		/* SSL/TLS in general */
(-)contrib/dma/local.c (-3 / +3 lines)
Lines 126-132 Link Here
126
deliver_local(struct qitem *it)
126
deliver_local(struct qitem *it)
127
{
127
{
128
	char fn[PATH_MAX+1];
128
	char fn[PATH_MAX+1];
129
	char line[1000];
129
	char line[MAX_LINE_RFC822];
130
	const char *sender;
130
	const char *sender;
131
	const char *newline = "\n";
131
	const char *newline = "\n";
132
	size_t linelen;
132
	size_t linelen;
Lines 205-213 Link Here
205
		goto wrerror;
205
		goto wrerror;
206
206
207
	while (!feof(it->mailf)) {
207
	while (!feof(it->mailf)) {
208
		if (fgets(line, sizeof(line), it->mailf) == NULL)
208
		if (fgets(line, sizeof(line)+1, it->mailf) == NULL)
209
			break;
209
			break;
210
		linelen = strlen(line);
210
		linelen = strnlen(line, sizeof(line));
211
		if (linelen == 0 || line[linelen - 1] != '\n') {
211
		if (linelen == 0 || line[linelen - 1] != '\n') {
212
			syslog(LOG_CRIT, "local delivery failed: corrupted queue file");
212
			syslog(LOG_CRIT, "local delivery failed: corrupted queue file");
213
			snprintf(errmsg, sizeof(errmsg), "corrupted queue file");
213
			snprintf(errmsg, sizeof(errmsg), "corrupted queue file");
(-)contrib/dma/mail.c (-4 / +2 lines)
Lines 41-48 Link Here
41
41
42
#include "dma.h"
42
#include "dma.h"
43
43
44
#define MAX_LINE_RFC822	1000
45
46
void
44
void
47
bounce(struct qitem *it, const char *reason)
45
bounce(struct qitem *it, const char *reason)
48
{
46
{
Lines 351-357 Link Here
351
	while (linelen > 0) {
349
	while (linelen > 0) {
352
		len = linelen;
350
		len = linelen;
353
		if (linelen > MAX_LINE_RFC822) {
351
		if (linelen > MAX_LINE_RFC822) {
354
			len = MAX_LINE_RFC822 - 10;
352
			len = MAX_LINE_RFC822 - 1;
355
		}
353
		}
356
354
357
		if (fwrite(line, len, 1, queue->mailf) != 1)
355
		if (fwrite(line, len, 1, queue->mailf) != 1)
Lines 363-369 Link Here
363
		if (fwrite("\n", 1, 1, queue->mailf) != 1)
361
		if (fwrite("\n", 1, 1, queue->mailf) != 1)
364
			return (-1);
362
			return (-1);
365
363
366
		line += MAX_LINE_RFC822 - 10;
364
		line += MAX_LINE_RFC822 - 1;
367
		linelen = strlen(line);
365
		linelen = strlen(line);
368
	}
366
	}
369
	return (0);
367
	return (0);
(-)contrib/dma/net.c (-3 / +3 lines)
Lines 352-358 Link Here
352
deliver_to_host(struct qitem *it, struct mx_hostentry *host)
352
deliver_to_host(struct qitem *it, struct mx_hostentry *host)
353
{
353
{
354
	struct authuser *a;
354
	struct authuser *a;
355
	char line[1000];
355
	char line[MAX_LINE_RFC822];
356
	size_t linelen;
356
	size_t linelen;
357
	int fd, error = 0, do_auth = 0, res = 0;
357
	int fd, error = 0, do_auth = 0, res = 0;
358
358
Lines 450-458 Link Here
450
450
451
	error = 0;
451
	error = 0;
452
	while (!feof(it->mailf)) {
452
	while (!feof(it->mailf)) {
453
		if (fgets(line, sizeof(line), it->mailf) == NULL)
453
		if (fgets(line, sizeof(line)+1, it->mailf) == NULL)
454
			break;
454
			break;
455
		linelen = strlen(line);
455
		linelen = strnlen(line, sizeof(line));
456
		if (linelen == 0 || line[linelen - 1] != '\n') {
456
		if (linelen == 0 || line[linelen - 1] != '\n') {
457
			syslog(LOG_CRIT, "remote delivery failed: corrupted queue file");
457
			syslog(LOG_CRIT, "remote delivery failed: corrupted queue file");
458
			snprintf(errmsg, sizeof(errmsg), "corrupted queue file");
458
			snprintf(errmsg, sizeof(errmsg), "corrupted queue file");

Return to bug 208261