summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Winter <winter@bfw-online.de>2022-01-31 10:52:35 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2022-01-31 10:57:59 +0000
commitd2f99aad044da58c05bd198ef3a6c9e0563e62ee (patch)
treeb344af1ddd645a9677964cff1fc6eedb45306a75
parent4b7a5d8aea1153d5204ba2a2bd1cabc3cbfe5056 (diff)
Account for failing utf-8 library call
-rw-r--r--src/src/utf8.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/src/utf8.c b/src/src/utf8.c
index 529a9a660..2bc81e839 100644
--- a/src/src/utf8.c
+++ b/src/src/utf8.c
@@ -133,7 +133,7 @@ return s;
uschar *
string_localpart_utf8_to_alabel(const uschar * utf8, uschar ** err)
{
-size_t ucs4_len;
+size_t ucs4_len = 0;
punycode_uint * p;
size_t p_len;
uschar * res;
@@ -142,6 +142,11 @@ int rc;
if (!string_is_utf8(utf8)) return string_copy(utf8);
p = (punycode_uint *) stringprep_utf8_to_ucs4(CCS utf8, -1, &ucs4_len);
+if (!p || !ucs4_len)
+ {
+ if (err) *err = US"l_u2a: bad UTF-8 input";
+ return NULL;
+ }
p_len = ucs4_len*4; /* this multiplier is pure guesswork */
res = store_get(p_len+5, is_tainted(utf8));