git://git.exim.org
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cfe6acf
)
Logging: fix crash on local_part utf8-conversion fail
author
Jeremy Harris
<jgh146exb@wizmail.org>
Thu, 24 Mar 2022 22:47:04 +0000
(22:47 +0000)
committer
Jeremy Harris
<jgh146exb@wizmail.org>
Mon, 28 Mar 2022 11:24:48 +0000
(12:24 +0100)
Broken-by: d2f99aad04
src/src/deliver.c
patch
|
blob
|
history
diff --git
a/src/src/deliver.c
b/src/src/deliver.c
index 029b7a59b6975cb7a42debb5856fe8bcf565dae8..1259cbe81ed35b68885909133116897f3eb8f08d 100644
(file)
--- a/
src/src/deliver.c
+++ b/
src/src/deliver.c
@@
-953,9
+953,22
@@
router_name = transport_name = NULL;
/*************************************************
/*************************************************
-* Generate local p
rt for logging
*
+* Generate local p
art for logging
*
*************************************************/
*************************************************/
+static uschar *
+string_get_lpart_sub(const address_item * addr, uschar * s)
+{
+#ifdef SUPPORT_I18N
+if (testflag(addr, af_utf8_downcvt))
+ {
+ uschar * t = string_localpart_utf8_to_alabel(s, NULL);
+ return t ? t : s; /* t is NULL on a failed conversion */
+ }
+#endif
+return s;
+}
+
/* This function is a subroutine for use in string_log_address() below.
Arguments:
/* This function is a subroutine for use in string_log_address() below.
Arguments:
@@
-970,32
+983,13
@@
string_get_localpart(address_item * addr, gstring * yield)
{
uschar * s;
{
uschar * s;
-s = addr->prefix;
-if (testflag(addr, af_include_affixes) && s)
- {
-#ifdef SUPPORT_I18N
- if (testflag(addr, af_utf8_downcvt))
- s = string_localpart_utf8_to_alabel(s, NULL);
-#endif
- yield = string_cat(yield, s);
- }
+if (testflag(addr, af_include_affixes) && (s = addr->prefix))
+ yield = string_cat(yield, string_get_lpart_sub(addr, s));
-s = addr->local_part;
-#ifdef SUPPORT_I18N
-if (testflag(addr, af_utf8_downcvt))
- s = string_localpart_utf8_to_alabel(s, NULL);
-#endif
-yield = string_cat(yield, s);
+yield = string_cat(yield, string_get_lpart_sub(addr, addr->local_part));
-s = addr->suffix;
-if (testflag(addr, af_include_affixes) && s)
- {
-#ifdef SUPPORT_I18N
- if (testflag(addr, af_utf8_downcvt))
- s = string_localpart_utf8_to_alabel(s, NULL);
-#endif
- yield = string_cat(yield, s);
- }
+if (testflag(addr, af_include_affixes) && (s = addr->suffix))
+ yield = string_cat(yield, string_get_lpart_sub(addr, s));
return yield;
}
return yield;
}