From: Stephan Bosch Date: Thu, 14 Dec 2017 12:02:10 +0000 (+0100) Subject: submission-login: Fix another NULL dereference occurring at an invalid reply from... X-Git-Tag: 2.3.0.rc1~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a46221f25bbaf310f73f77bec24f2d3f0c80d4fe;p=thirdparty%2Fdovecot%2Fcore.git submission-login: Fix another NULL dereference occurring at an invalid reply from the backend server. 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. --- diff --git a/src/submission-login/submission-proxy.c b/src/submission-login/submission-proxy.c index bf06f04aa2..8053df23c6 100644 --- a/src/submission-login/submission-proxy.c +++ b/src/submission-login/submission-proxy.c @@ -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: