From 1454be031272996c503cda0f5c99bf09fffa552c Mon Sep 17 00:00:00 2001 From: "Steffen \"Daode\" Nurpmeso" Date: Thu, 28 Nov 2013 11:51:26 +0100 Subject: [PATCH] send.c:_print_part_info(): filenames *surely*are* MIME encoded! --- send.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/send.c b/send.c index 959fb839b..525913eb2 100644 --- a/send.c +++ b/send.c @@ -220,8 +220,18 @@ _print_part_info(struct str *out, struct mimepart *mip, /* Max. 27 */ if (is_ign("content-disposition", 19, doign) && mip->m_filename != NULL) { - cd.s = ac_alloc(2 + 25 + 1); - cd.l = snprintf(cd.s, 2 + 25 + 1, ", %.25s", mip->m_filename); + struct str ti, to; + + ti.l = strlen(ti.s = mip->m_filename); + mime_fromhdr(&ti, &to, TD_ISPR | TD_ICONV | TD_DELCTRL); + to.l = MIN(to.l, 25); + cd.s = ac_alloc(to.l + 3); + cd.s[0] = ','; + cd.s[1] = ' '; + memcpy(cd.s + 2, to.s, to.l); + to.l += 2; + cd.s[to.l] = '\0'; + free(to.s); } /* Take care of "99.99", i.e., 5 */ -- 2.11.4.GIT