summary refs log tree commit diff
path: root/maddr.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2021-06-18 01:03:17 +0200
committerLeah Neukirchen <leah@vuxu.org>2021-06-18 01:13:03 +0200
commit4f1f0ea2b3193fb3b2f9222b1e71301c2aabc8a6 (patch)
treed8f2d071f213d1f16d2f9f44c78976122d42821d /maddr.c
parent0ed7f72d31d01c08082407f11a167552ba75cf0d (diff)
downloadmblaze-4f1f0ea2b3193fb3b2f9222b1e71301c2aabc8a6.tar.gz
mblaze-4f1f0ea2b3193fb3b2f9222b1e71301c2aabc8a6.tar.xz
mblaze-4f1f0ea2b3193fb3b2f9222b1e71301c2aabc8a6.zip
maddr: decode only display part of address
RFC 2047.6.2:
   NOTE: Decoding and display of encoded-words occurs *after* a
   structured field body is parsed into tokens.
Diffstat (limited to 'maddr.c')
-rw-r--r--maddr.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/maddr.c b/maddr.c
index 0169458..4982a8c 100644
--- a/maddr.c
+++ b/maddr.c
@@ -57,12 +57,14 @@ addr(char *file)
 		v = blaze822_chdr(msg, h);
 		if (v) {
 			char *disp, *addr;
-			char vdec[16384];
-			blaze822_decode_rfc2047(vdec, v, sizeof vdec - 1, "UTF-8");
-			vdec[sizeof vdec - 1] = 0;
-			v = vdec;
-
+			char ddec[16384];
 			while ((v = blaze822_addr(v, &disp, &addr))) {
+				if (disp) {
+					blaze822_decode_rfc2047(ddec, disp, sizeof ddec - 1, "UTF-8");
+					ddec[sizeof ddec - 1] = 0;
+					disp = ddec;
+				}
+
 				if (disp && addr && strcmp(disp, addr) == 0)
 					disp = 0;