Skip to content

Commit

Permalink
lib-smtp: server: DATA command: Make sure there is a transaction in s…
Browse files Browse the repository at this point in the history
…mtp_server_connection_data_check_state() before using it.

This fixes a potential NULL dereference.
Found by Coverity.
  • Loading branch information
stephanbosch authored and sirainen committed Dec 11, 2017
1 parent eda1c4f commit 237ff49
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib-smtp/smtp-server-cmd-data.c
Expand Up @@ -49,7 +49,8 @@ bool smtp_server_connection_data_check_state(struct smtp_server_cmd_ctx *cmd)
/* special handling for LMTP */
if (conn->set.protocol == SMTP_PROTOCOL_LMTP) {
/* check valid RCPT (at least one) */
if (!smtp_server_transaction_has_rcpt(conn->state.trans)) {
if (conn->state.trans == NULL ||
!smtp_server_transaction_has_rcpt(conn->state.trans)) {
if (data_cmd->chunk_size > 0 && data_cmd->chunk_last) {
/* RFC 2033, Section 4.3:
If there were no previously successful RCPT
Expand Down

0 comments on commit 237ff49

Please sign in to comment.