anomy-bugs

Re: base64 encodings with linelength % 4 != 0

From: Bjarni R. Einarsson (16186@xyz.molar.is)
Date: Wed 07 Aug 2002 - 09:32:15 UTC

  • Next message: Bjarni R. Einarsson: "Re: base64 encodings with linelength % 4 != 0"

    On 2002-08-06, 23:48:20 (+0200), Joerg Lenneis wrote:
    > Dear all,
    >
    > after encountering weird corrupted attachments from the Sanitizer, I
    > dug into the source and ended up at the following function in
    > MIMEStream.pm:
    >
    > sub DecodeBase64
    > {
    > my $reader = shift;
    > my $line = shift;
    >
    > # This hacks the decoder to handle mangled Base64 text properly, by
    > # properly ignoring white space etc. Note that this will lose the
    > # last 1-3 bytes of data if it isn't properly padded. We also record
    > # the encoded line-length, so we can re-encode stuff using the same
    > # length.
    ...
    > OK. Unfortunately, I think, that the changes to the Sanitizer to
    > accomodate this behaviour would be quite substantial, since there is
    > an inherent assumption about a line never having anything to do with
    > the following line. Any comments?

    That comment block means: "this code makes sure Base64 encoded
    attachments with line lengths not divisible by four will work
    properly". :-)

    So, no substantial changes are not necessary, the sanitizer is
    already written to handle such things. There is almost certainly
    some other explanation for your problem (unless the code is broken,
    which is always a remote possibility). Perhaps you would want to
    send me a copy of the offending message to take a look at?

    -- 
    Bjarni R. Einarsson                           PGP: 02764305, B7A3AB89
     16186@xyz.molar.is                -><-              http://bre.klaki.net/
    

    Check out my open-source email sanitizer: http://mailtools.anomy.net/ Spammers, please send plenty of email to: 16310@xyz.molar.is



    hosted by molar.is