1 Patch: 70_invalid_utf8_dos.patch
2 Author: Lionel Elie Mamane <lionel@mamane.lu>
3 Avoid DOS if attachement filename is invalid Unicode string
4 Index: Mailman/Handlers/Scrubber.py
5 ===================================================================
6 --- Mailman/Handlers/Scrubber.py.orig 2006-08-15 15:14:15.000000000 +0800
7 +++ Mailman/Handlers/Scrubber.py 2006-08-15 15:14:54.000000000 +0800
11 desc = part.get('content-description', _('not available'))
12 - filename = part.get_filename(_('not available'))
14 + filename = part.get_filename(_('not available'))
15 + except UnicodeDecodeError:
16 + filename = _('not available')
17 filename = Utils.oneline(filename, lcset)
18 replace_payload_by_text(part, _("""\
19 A non-text attachment was scrubbed...
21 ctype = msg.get_content_type()
22 # i18n file name is encoded
23 lcset = Utils.GetCharSet(mlist.preferred_language)
24 - filename = Utils.oneline(msg.get_filename(''), lcset)
26 + filename = Utils.oneline(msg.get_filename(''), lcset)
27 + except UnicodeDecodeError:
29 fnext = os.path.splitext(filename)[1]
30 # For safety, we should confirm this is valid ext for content-type
31 # but we can use fnext if we introduce fnext filtering
34 # Now base the filename on what's in the attachment, uniquifying it if
36 - filename = msg.get_filename()
38 + filename = msg.get_filename()
39 + except UnicodeDecodeError:
41 if not filename or mm_cfg.SCRUBBER_DONT_USE_ATTACHMENT_FILENAME:
42 filebase = 'attachment'