summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/smtp_session.c9
-rw-r--r--usr.sbin/smtpd/smtpd.h3
2 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index d5ba71e98cf..234fdcb05df 100644
--- a/usr.sbin/smtpd/smtp_session.c
+++ b/usr.sbin/smtpd/smtp_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp_session.c,v 1.56 2009/02/18 00:29:52 gilles Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.57 2009/02/19 11:33:25 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -784,8 +784,13 @@ read:
s->s_tm = time(NULL);
nr = EVBUFFER_LENGTH(bev->input);
line = evbuffer_readline(bev->input);
- if (line == NULL)
+ if (line == NULL) {
+ if (EVBUFFER_LENGTH(bev->input) > SMTP_ANYLINE_MAX) {
+ session_respond(s, "500 Line too long");
+ s->s_flags |= F_QUIT;
+ }
return;
+ }
nr -= EVBUFFER_LENGTH(bev->input);
if (s->s_state == S_DATACONTENT) {
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index cdbb828d1b9..212e2fee1ef 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.73 2009/02/18 22:39:12 jacekm Exp $ */
+/* $OpenBSD: smtpd.h,v 1.74 2009/02/19 11:33:25 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -70,6 +70,7 @@
/* rfc5321 limits */
#define SMTP_TEXTLINE_MAX 1000
#define SMTP_CMDLINE_MAX 512
+#define SMTP_ANYLINE_MAX SMTP_TEXTLINE_MAX
#define F_STARTTLS 0x01
#define F_SSMTP 0x02