* Exim - an Internet mail transport agent *
*************************************************/
+/* Copyright (c) The Exim Maintainers 2021 - 2022 */
/* Copyright (c) University of Cambridge 1995 - 2018 */
/* See the file NOTICE for conditions of use and distribution. */
while (isspace(*s)) s++;
DEBUG(D_rewrite)
- debug_printf("rewrite_one_header: type=%c:\n %s", h->type, h->text);
+ debug_printf_indent("rewrite_one_header: type=%c:\n %s", h->type, h->text);
f.parse_allow_group = TRUE; /* Allow group syntax */
recipient = parse_extract_address(s, &errmess, &start, &end, &domain, FALSE);
*ss = terminator;
sprev = s;
- s = ss + (terminator ? 1 :0);
+ s = ss + (terminator ? 1 : 0);
while (isspace(*s)) s++;
/* There isn't much we can do for syntactic disasters at this stage.
Pro tem (possibly for ever) ignore them.
- If we got nothing, they there was any sort of error: non-parsable address,
+ If we got nothing, then there was any sort of error: non-parsable address,
empty address, overlong addres. Sometimes the result matters, sometimes not.
It seems this function is called for *any* header we see. */
-
if (!recipient)
{
- if (rewrite_rules || routed_old)
+ /* Handle unparesable addresses in the header. Slightly ugly because a
+ null output from the extract can also result from a header without an
+ address, "To: undisclosed recpients:;" being the classic case. */
+
+ if ((rewrite_rules || routed_old) && Ustrcmp(errmess, "empty address") != 0)
{
log_write(0, LOG_MAIN, "rewrite: %s", errmess);
exim_exit(EXIT_FAILURE);
int oldlen = end - start;
header_line * prev = newh ? newh : h;
- uschar * newt = store_get_perm(prev->slen - oldlen + newlen + 4, TRUE);
+ uschar * newt = store_get_perm(prev->slen - oldlen + newlen + 4, GET_TAINTED);
uschar * newtstart = newt;
int type = prev->type;
store_reset(function_reset_point);
function_reset_point = store_mark();
- newh = store_get(sizeof(header_line), FALSE);
+ newh = store_get(sizeof(header_line), GET_UNTAINTED);
newh->type = type;
newh->slen = slen;
newh->text = string_copyn(newtstart, slen);