Use safer routine for possibly-overlapping copy
[exim.git] / src / src / transports / smtp.c
index 016f9783ff82cf7395f973ca76b41c07762ab2a4..ca06bf6bd8a7609dac1a72e6c26e8ececd8c8028 100644 (file)
@@ -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';