]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-server-cmd-helo - Fix crash occurring upon pipelined EHLO with invalid...
authorStephan Bosch <stephan.bosch@open-xchange.com>
Sun, 18 Apr 2021 10:33:01 +0000 (12:33 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 6 Oct 2021 13:03:46 +0000 (13:03 +0000)
Failed to check for NULL in domain value for a pipelined EHLO/HELO command.

src/lib-smtp/smtp-server-cmd-helo.c

index a9666e40026bbca79335d10730fd6c401fb49f6a..f1f908a82b8f7232a124b5215457391aa62fa5b5 100644 (file)
@@ -41,8 +41,7 @@ cmd_helo_next(struct smtp_server_cmd_ctx *cmd,
 {
        struct smtp_server_connection *conn = cmd->conn;
 
-       if (conn->helo.domain == NULL ||
-           strcmp(conn->helo.domain, data->helo.domain) != 0 ||
+       if (null_strcmp(conn->helo.domain, data->helo.domain) != 0 ||
            conn->helo.old_smtp != data->helo.old_smtp)
                data->changed = TRUE; /* Definitive assessment */
 }
@@ -80,8 +79,7 @@ smtp_server_cmd_helo_run(struct smtp_server_cmd_ctx *cmd, const char *params,
        helo_data->first = first;
        command->data = helo_data;
 
-       if (conn->helo.domain == NULL ||
-           (domain != NULL && strcmp(conn->helo.domain, domain) != 0) ||
+       if (null_strcmp(conn->helo.domain, domain) != 0 ||
            conn->helo.old_smtp != old_smtp)
                helo_data->changed = TRUE; /* Preliminary assessment */