Fix 2-phase, in-order queue run delivery order
[exim.git] / src / src / retry.c
index 6b977dd58ba122d64c5d6dcfb71ffcf890833be3..9dfe1d587778cf86268646cfc4649c6dcb32ade1 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2020 - 2023 */
+/* Copyright (c) The Exim Maintainers 2020 - 2024 */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
 /* See the file NOTICE for conditions of use and distribution. */
 /* SPDX-License-Identifier: GPL-2.0-or-later */
@@ -678,7 +678,13 @@ for (int i = 0; i < 3; i++)
          ? US string_printing(rti->message)
          : US"unknown error";
         message_length = Ustrlen(message);
-        if (message_length > EXIM_DB_RLIMIT) message_length = EXIM_DB_RLIMIT;
+        if (message_length > EXIM_DB_RLIMIT)
+         {
+         DEBUG(D_retry)
+           debug_printf_indent("truncating message from %u to %u bytes\n",
+                               message_length, EXIM_DB_RLIMIT);
+         message_length = EXIM_DB_RLIMIT;
+         }
 
         /* Read a retry record from the database or construct a new one.
         Ignore an old one if it is too old since it was last updated. */
@@ -851,7 +857,7 @@ for (int i = 0; i < 3; i++)
         retry_record->basic_errno = rti->basic_errno;
         retry_record->more_errno = rti->more_errno;
         Ustrncpy(retry_record->text, message, message_length);
-        retry_record->text[message_length] = 0;
+        retry_record->text[message_length] = 0;        /* nul-term string in db */
 
         DEBUG(D_retry)
           {