]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
submission-login: Fix another NULL dereference occurring at an invalid reply from...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Thu, 14 Dec 2017 12:02:10 +0000 (13:02 +0100)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 14 Dec 2017 18:38:02 +0000 (20:38 +0200)
The text variable was still being used when it could be NULL. Made the offending code dependent on the reply validity check.

Problem found by Coverity.

src/submission-login/submission-proxy.c

index bf06f04aa276054f6b6c929894ce8432eeb22774..8053df23c6d98f0ea70c1c8b36ed0c69a1886f29 100644 (file)
@@ -234,6 +234,10 @@ int submission_proxy_parse_line(struct client *client, const char *line)
                invalid_line = TRUE;
        } else {
                text++;
+
+               if ((subm_client->proxy_capability &
+                       SMTP_CAPABILITY_ENHANCEDSTATUSCODES) != 0)
+                       text = strip_enhanced_code(text, &enh_code);
        }
        if (subm_client->proxy_reply_status != 0 &&
                subm_client->proxy_reply_status != status) {
@@ -251,10 +255,6 @@ int submission_proxy_parse_line(struct client *client, const char *line)
                subm_client->proxy_reply_status = status;
        }
 
-       if ((subm_client->proxy_capability &
-               SMTP_CAPABILITY_ENHANCEDSTATUSCODES) != 0)
-               text = strip_enhanced_code(text, &enh_code);
-
        output = login_proxy_get_ostream(client->login_proxy);
        switch (subm_client->proxy_state) {
        case SUBMISSION_PROXY_BANNER: