summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-10-03 10:02:44 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-10-03 10:02:44 +0000
commit6d1c5d24cc973dd87d53bbc6a0dbc51f8dffd75e (patch)
tree0fe3c23a32f83b568dfbb112fb33a772849cf081
parent6eb6d9af85caf2b0d458746a2c653ac325e0a687 (diff)
Avoid NULL dereference when the final RCPT TO is refused.
Reported by Didier Wiroth <dwiroth@gmail.com>
-rw-r--r--usr.sbin/smtpd/client.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/client.c b/usr.sbin/smtpd/client.c
index b50ffa7445a..e5482230d7d 100644
--- a/usr.sbin/smtpd/client.c
+++ b/usr.sbin/smtpd/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.6 2009/09/22 15:44:31 jacekm Exp $ */
+/* $OpenBSD: client.c,v 1.7 2009/10/03 10:02:43 jacekm Exp $ */
/*
* Copyright (c) 2009 Jacek Masiulaniec <jacekm@dobremiasto.net>
@@ -612,6 +612,9 @@ client_write(struct smtp_client *sp)
else
sp->rcptsent = TAILQ_NEXT(sp->rcptsent, entry);
+ if (sp->rcptsent == NULL)
+ goto done;
+
if (client_putln(sp, "RCPT TO: <%s>", sp->rcptsent->mbox) < 0)
goto done;
break;