From: Jeremy Harris Date: Fri, 20 Oct 2017 22:21:27 +0000 (+0100) Subject: Use safer routine for possibly-overlapping copy X-Git-Tag: exim-4_90_RC1~21 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e5ab0ba9eb0f4424dfa31128f36b27b6769d7795;p=exim.git Use safer routine for possibly-overlapping copy Fixes a logging bug seen on aarch64 --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 4f7f63818..9404b7a57 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -173,6 +173,11 @@ JH/29 Fix queue_run_in_order to ignore the PID portion of the message ID. This matters on fast-turnover and PID-randomising systems, which were getting out-of-order delivery. +JH/30 Fix a logging bug on aarch64: an unsafe routine was previously used for + a possibly-overlapping copy. The symptom was that "Remote host closed + connection in response to HELO" was logged instead of the actual 4xx + error for the HELO. + Exim version 4.89 ----------------- diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 016f9783f..ca06bf6bd 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -1820,7 +1820,7 @@ goto SEND_QUIT; errno = ERRNO_SMTPCLOSED; goto EHLOHELO_FAILED; } - Ustrncpy(sx->buffer, rsp, sizeof(sx->buffer)/2); + memmove(sx->buffer, rsp, Ustrlen(rsp)); goto RESPONSE_FAILED; } } @@ -2176,11 +2176,6 @@ return OK; sx->send_quit = FALSE; goto FAILED; - /* This label is jumped to directly when a TLS negotiation has failed, - or was not done for a host for which it is required. Values will be set - in message and errno, and setting_up will always be true. Treat as - a temporary error. */ - EHLOHELO_FAILED: code = '4'; message = string_sprintf("Remote host closed connection in response to %s" @@ -2188,6 +2183,11 @@ return OK; sx->send_quit = FALSE; goto FAILED; + /* This label is jumped to directly when a TLS negotiation has failed, + or was not done for a host for which it is required. Values will be set + in message and errno, and setting_up will always be true. Treat as + a temporary error. */ + #ifdef SUPPORT_TLS TLS_FAILED: code = '4';