[exim-dev] [Bug 466] RFC 2231 support in MIME scanning
--- You are receiving this mail because: --- You are the QA contact for the bug. http://bugs.exim.org/show_bug.cgi?id=466 --- Comment #5 from Git Commit 2015-04-26 17:17:07 --- Git commit: http://git.exim.org/exim.git/commitdiff/627d1a1b61d9c535835221afcbe1b9cd6548cd3b commit 627d1a1b61d9c535835221afcbe1b9cd6548cd3b Author: Jeremy Harris AuthorDate: Sun Apr 26 16:25:11 2015 +0100 Commit: Jeremy Harris CommitDate: Sun Apr 26 16:25:11 2015 +0100 MIME: recode 2231-to-2047 safely. Bug 466 The original expansion was vulnerable to odd filenames. --- src/src/mime.c | 32 +++- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/src/mime.c b/src/src/mime.c index aeab33d..6bffa78 100644 --- a/src/src/mime.c +++ b/src/src/mime.c @@ -543,6 +543,32 @@ return s; } +static uschar * +rfc2231_to_2047(const uschar * fname, const uschar * charset, int * len) +{ +int size = 0, ptr = 0; +uschar * val = string_cat(NULL, &size, &ptr, US"=?", 2); +uschar c; + +val = string_cat(val, &size, &ptr, charset, Ustrlen(charset)); +val = string_cat(val, &size, &ptr, US"?Q?", 3); + +while ((c = *fname)) + if (c == '%' && isxdigit(fname[1]) && isxdigit(fname[2])) +{ +val = string_cat(val, &size, &ptr, US"=", 1); +val = string_cat(val, &size, &ptr, ++fname, 2); +fname += 2; +} + else +val = string_cat(val, &size, &ptr, fname++, 1); + +val = string_cat(val, &size, &ptr, US"?=", 2); +val[*len = ptr] = '\0'; +return val; +} + + int mime_acl_check(uschar *acl, FILE *f, struct mime_boundary_context *context, uschar **user_msgptr, uschar **log_msgptr) @@ -689,11 +715,7 @@ while(1) else p = q; - temp_string = expand_string(string_sprintf( - "=?%s?Q?${sg{%s}{\\N%%([\\dA-Fa-f]{2})\\N}{=\\$1}}?=", - mime_filename_charset, p)); - slen = Ustrlen(temp_string); - + temp_string = rfc2231_to_2047(p, mime_filename_charset, &slen); temp_string = rfc2047_decode(temp_string, FALSE, NULL, 32, NULL, &err_msg); size = Ustrlen(temp_string); -- Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email -- ## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[exim-dev] [Bug 466] RFC 2231 support in MIME scanning
--- You are receiving this mail because: --- You are the QA contact for the bug. http://bugs.exim.org/show_bug.cgi?id=466 Git Commit changed: What|Removed |Added CC||g...@exim.org --- Comment #4 from Git Commit 2015-04-26 01:17:06 --- Git commit: http://git.exim.org/exim.git/commitdiff/f846c8f531d5615c24a6d4dc0afb9815c4f766f7 commit f846c8f531d5615c24a6d4dc0afb9815c4f766f7 Author: Jeremy Harris AuthorDate: Sun Apr 26 00:05:08 2015 +0100 Commit: Jeremy Harris CommitDate: Sun Apr 26 00:46:18 2015 +0100 mime: support rfc2231 for filenames. bug 466 patch originally from alexander shikoff, heavily reworked by jh. doc/doc-docbook/spec.xfpt |3 +- doc/doc-txt/ChangeLog |3 + src/src/macros.h|9 +- src/src/mime.c | 371 +-- src/src/mime.h | 18 +- test/log/4000 |3 + test/mail/4000.userx| 65 +++ test/scripts/4000-scanning/4000 | 28 +++ test/stdout/4000| 11 ++ 9 files changed, 368 insertions(+), 143 deletions(-) -- Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email -- ## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[exim-dev] [Bug 466] RFC 2231 support in MIME scanning
--- You are receiving this mail because: --- You are the QA contact for the bug. http://bugs.exim.org/show_bug.cgi?id=466 Jeremy Harris changed: What|Removed |Added Status|NEW |ASSIGNED -- Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email -- ## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[exim-dev] [Bug 466] RFC 2231 support in MIME scanning
--- You are receiving this mail because: --- You are the QA contact for the bug. http://bugs.exim.org/show_bug.cgi?id=466 Jeremy Harris changed: What|Removed |Added AssignedTo|t...@duncanthrax.net |jgh146...@wizmail.org Target Milestone|Exim 4.77 |Exim 4.86 -- Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email -- ## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[exim-dev] [Bug 466] RFC 2231 support in MIME scanning
--- You are receiving this mail because: --- You are the QA contact for the bug. http://bugs.exim.org/show_bug.cgi?id=466 Jeremy Harris changed: What|Removed |Added CC||a...@bestmx.ru --- Comment #3 from Jeremy Harris 2015-04-25 23:51:02 --- *** Bug 1065 has been marked as a duplicate of this bug. *** -- Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email -- ## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[exim-dev] [Bug 466] RFC 2231 support in MIME scanning
--- You are receiving this mail because: --- You are the QA contact for the bug. http://bugs.exim.org/show_bug.cgi?id=466 Nigel Metheringham changed: What|Removed |Added Target Milestone|Exim 4.72 |Exim 4.73 Target Milestone|Exim 4.73 |Exim 4.77 Jeremy Harris changed: What|Removed |Added CC||jgh146...@wizmail.org --- Comment #2 from Jeremy Harris 2015-01-01 22:56:17 --- See also bug 1065 -- Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email -- ## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[exim-dev] [Bug 466] RFC 2231 support in MIME scanning
--- You are receiving this mail because: --- You are the QA contact for the bug. http://bugs.exim.org/show_bug.cgi?id=466 --- Comment #1 from Alexander Shikoff <[EMAIL PROTECTED]> 2008-12-04 09:13:28 --- Created an attachment (id=290) --> (http://bugs.exim.org/attachment.cgi?id=290) Experimental patch that resolves the issue -- Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email -- ## List details at http://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##