]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: client: Fix potential segfault occurring after receiving RCPT reply.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sun, 26 Aug 2018 13:16:17 +0000 (15:16 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 29 Aug 2018 13:11:38 +0000 (13:11 +0000)
Could occur when RCPT reply is received befor DATA command is sent in LMTP session.

Problem found by Coverity.

src/lib-smtp/smtp-client-transaction.c

index 0d0638a753c1313b0be7f21c4f33fe47cd0fddde..1d08d42479a342f8b44cc11d9966f91423431e54 100644 (file)
@@ -557,7 +557,8 @@ smtp_client_transaction_rcpt_cb(const struct smtp_reply *reply,
                if (array_count(&trans->rcpts) == 0) {
                        /* abort transaction if all recipients failed */
                        smtp_client_transaction_abort(trans);
-               } else if (conn->protocol == SMTP_PROTOCOL_LMTP) {
+               } else if (conn->protocol == SMTP_PROTOCOL_LMTP &&
+                          trans->cmd_data != NULL) {
                        smtp_client_command_set_replies(trans->cmd_data,
                                array_count(&trans->rcpts));
                }