Fix string_copy() macro to not multiple-eval args. Bug 2603
authorJeremy Harris <jgh146exb@wizmail.org>
Fri, 19 Jun 2020 23:54:05 +0000 (00:54 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Sat, 20 Jun 2020 00:05:08 +0000 (01:05 +0100)
Broken-by: a76d120aed
doc/doc-txt/ChangeLog
src/src/functions.h

index 0354ff2580180857f610dd5760405b71995f8a61..717e0d2c7cfeeacff1cbcb4bb8bfd947ec77c348 100644 (file)
@@ -49,6 +49,12 @@ JH/09 Relax restrictions on ACL verify condition needing access to message
       permit also mime, dkim, prdr quit and notquit.  Applies to header-syntax,
       not_blind, header_sender and header_names_ascii verification.
 
+JH/10 Bug 2603: Fix coding of string copying to only evaluate arguments once.
+      Previously a macro used one argument twice; when called with the
+      argument as an expression having side-effects, incorrect operation
+      resulted.  Use an inlineable function.
+
+
 
 Exim version 4.94
 -----------------
index 1f0c30d0eb433d4f4f44e5148842110d9e307b95..110d4db1944aa97a6a2a967883bfd99b61b15627 100644 (file)
@@ -772,9 +772,9 @@ string_copy_trc(const uschar * s, const char * func, int line)
 /* Simple string-copy functions maintaining the taint */
 
 #define string_copyn(s, len) \
-       string_copyn_taint_trc((s), (len), is_tainted(s), __FUNCTION__, __LINE__)
+       string_copyn_trc((s), (len), __FUNCTION__, __LINE__)
 #define string_copy(s) \
-       string_copy_taint_trc((s), is_tainted(s), __FUNCTION__, __LINE__)
+       string_copy_trc((s), __FUNCTION__, __LINE__)
 
 
 /*************************************************