From f5ec422783f1eca5928b0c6acdfd53568dcab9ee Mon Sep 17 00:00:00 2001 From: Gilles Chehade Date: Mon, 30 Nov 2015 13:10:14 +0000 Subject: handle "mda command too long" as a tempfail --- usr.sbin/smtpd/mda.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'usr.sbin/smtpd') diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c index 0d6d38823d9..606c42e2d4c 100644 --- a/usr.sbin/smtpd/mda.c +++ b/usr.sbin/smtpd/mda.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mda.c,v 1.113 2015/11/30 12:26:55 sunil Exp $ */ +/* $OpenBSD: mda.c,v 1.114 2015/11/30 13:10:13 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -281,8 +281,17 @@ mda_imsg(struct mproc *p, struct imsg *imsg) deliver.userinfo = *userinfo; (void)strlcpy(deliver.user, userinfo->username, sizeof(deliver.user)); - (void)strlcpy(deliver.to, e->buffer, - sizeof(deliver.to)); + if (strlcpy(deliver.to, e->buffer, + sizeof(deliver.to)) + >= sizeof(deliver.to)) { + mda_queue_tempfail(e->id, + "mda command too long", + ESC_OTHER_MAIL_SYSTEM_STATUS); + mda_log(e, "TempFail", + "mda command too long"); + mda_done(s); + return; + } break; case A_MBOX: -- cgit v1.2.3