X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/a85c067ba6c6940512cf57ec213277a370d87e70..107077d7fd6736711bf5cd980221723401d37c51:/src/src/parse.c diff --git a/src/src/parse.c b/src/src/parse.c index 93b12bc77..29f98e1e2 100644 --- a/src/src/parse.c +++ b/src/src/parse.c @@ -2,10 +2,10 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) The Exim Maintainers 2020 - 2022 */ +/* Copyright (c) The Exim Maintainers 2020 - 2023 */ /* Copyright (c) University of Cambridge 1995 - 2018 */ /* See the file NOTICE for conditions of use and distribution. */ -/* SPDX-License-Identifier: GPL-2.0-only */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ /* Functions for parsing addresses */ @@ -875,26 +875,26 @@ Returns: pointer to the original string, if no quoting needed, or */ const uschar * -parse_quote_2047(const uschar *string, int len, const uschar *charset, +parse_quote_2047(const uschar * string, int len, const uschar * charset, BOOL fold) { const uschar * s = string; -int hlen, l; +int hlen, line_off; BOOL coded = FALSE; BOOL first_byte = FALSE; gstring * g = - string_fmt_append(NULL, "=?%s?Q?", charset ? charset : US"iso-8859-1"); + string_fmt_append(NULL, "=?%s?Q?%n", charset ? charset : US"iso-8859-1", &hlen); -hlen = l = g->ptr; +line_off = hlen; for (s = string; len > 0; s++, len--) { int ch = *s; - if (g->ptr - l > 67 && !first_byte) + if (g->ptr - line_off > 67 && !first_byte) { g = fold ? string_catn(g, US"?=\n ", 4) : string_catn(g, US"?= ", 3); - l = g->ptr; + line_off = g->ptr; g = string_catn(g, g->s, hlen); }