diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2019-10-03 05:08:22 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2019-10-03 05:08:22 +0000 |
commit | 21c60906ea0cc2813cb2befcf8ec71a2305f45e8 (patch) | |
tree | 9054d68fa4cd910d8d24c0b4ac471ec7cb9109ee /usr.sbin | |
parent | f7dc5a8078135ed2ce2b5664a5ab083eb996d814 (diff) |
we should never hit the smtp reports with an s->tx set to NULL but better
be safe than sorry, check upfront
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 3002ed6fa12..95db9099e13 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.413 2019/10/03 05:04:45 gilles Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.414 2019/10/03 05:08:21 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -2105,14 +2105,18 @@ smtp_reply(struct smtp_session *s, char *fmt, ...) switch (buf[0]) { case '2': - if (s->last_cmd == CMD_MAIL_FROM) - report_smtp_tx_mail("smtp-in", s->id, s->tx->msgid, s->cmd + 10, 1); - else if (s->last_cmd == CMD_RCPT_TO) - report_smtp_tx_rcpt("smtp-in", s->id, s->tx->msgid, s->cmd + 8, 1); + if (s->tx) { + if (s->last_cmd == CMD_MAIL_FROM) + report_smtp_tx_mail("smtp-in", s->id, s->tx->msgid, s->cmd + 10, 1); + else if (s->last_cmd == CMD_RCPT_TO) + report_smtp_tx_rcpt("smtp-in", s->id, s->tx->msgid, s->cmd + 8, 1); + } break; case '3': - if (s->last_cmd == CMD_DATA) - report_smtp_tx_data("smtp-in", s->id, s->tx->msgid, 1); + if (s->tx) { + if (s->last_cmd == CMD_DATA) + report_smtp_tx_data("smtp-in", s->id, s->tx->msgid, 1); + } break; case '5': case '4': |