X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/da683a61556bbbebdffcbebf2668da58da59f898..8b1e9bc2cac17ee24d595c97dcf97d9b016f8a46:/src/src/parse.c diff --git a/src/src/parse.c b/src/src/parse.c index 3f1ba222f..086b010c3 100644 --- a/src/src/parse.c +++ b/src/src/parse.c @@ -979,12 +979,12 @@ if (i < len) /* No non-printers; use the RFC 822 quoting rules */ -if (!len) +if (len <= 0 || len >= INT_MAX/4) { - return string_copy_taint(US"", is_tainted(phrase)); + return string_copy_taint(CUS"", is_tainted(phrase)); } -buffer = store_get(len*4, is_tainted(phrase)); +buffer = store_get((len+1)*4, is_tainted(phrase)); s = phrase; end = s + len; @@ -1129,12 +1129,7 @@ while (s < end) { if (ss >= end) ss--; *t++ = '('; - if (ss < s) - { - /* Someone has ended the string with "(". */ - ss = s; - } - else + if (ss > s) { Ustrncpy(t, s, ss-s); t += ss-s;