Propagate null gstring through string_catn()
[exim.git] / src / src / routers / redirect.c
index 13b6e5244684e37aabf0b69479c6a475d4e5e144..8e0b7e529a4439151598bf112eb47c2670cd25c3 100644 (file)
@@ -3,7 +3,7 @@
 *************************************************/
 
 /* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 */
+/* Copyright (c) The Exim Maintainers 2020 - 2021 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 
@@ -529,9 +529,6 @@ int options = ob->bit_options;
 int frc = 0;
 int xrc = 0;
 
-addr_local = addr_local;     /* Keep picky compilers happy */
-addr_remote = addr_remote;
-
 /* Initialize the data to be propagated to the children */
 
 addr_prop.address_data = deliver_address_data;
@@ -737,15 +734,13 @@ switch (frc)
       addr->message = yield == FAIL ? US"forced rejection" : US"forced defer";
     else
       {
-      int ovector[3];
-      if (ob->forbid_smtp_code &&
-         pcre_exec(regex_smtp_code, NULL, CS addr->message,
-           Ustrlen(addr->message), 0, PCRE_EOPT,
-           ovector, sizeof(ovector)/sizeof(int)) >= 0)
+      uschar * matched;
+      if (  ob->forbid_smtp_code
+        && regex_match(regex_smtp_code, addr->message, -1, &matched))
        {
        DEBUG(D_route) debug_printf("SMTP code at start of error message "
          "is ignored because forbid_smtp_code is set\n");
-       addr->message += ovector[1];
+       addr->message += Ustrlen(matched);
        }
       addr->user_message = addr->message;
       setflag(addr, af_pass_message);