Re: [gmime-devel] bug in mime generation with specific filename



Hi Peter, Evil,

Thanks Peter! This patch looks good and I've committed it to git master.

Jeff

On 05/09/2012 03:43 PM, Peter Bloomfield wrote:
Jeff and Evil,

I believe the issue is that the RFC 2184 parameter decoder should not look for a charset in the "*#=" form of the parameter. Looking for one doesn't cause any problems except when the value contains a single quote, as in the test case, but in that case it eats the rest of the value.

Suggested patch attached.

Best,

Peter

On May  8, 2012, at  1:16 PM, evil legacy wrote:
Hey all,

Without further ado, here's a code snippet to reproduce the bug:

<code>
void print_mime(GMimeMessage *m)
{
    GMimeStream *stdout_stream = g_mime_stream_fs_new(0);
    g_mime_object_write_to_stream((GMimeObject *)m, stdout_stream);
}

int main(int argc, char **argv)
{
    g_mime_init(0);

    const char *filename = "Ferry Corsten - Corsten's Countdown
171-200 (nic nie brakuje).odt";

    GMimeMessage *m = g_mime_message_new(0);
    GMimePart    *p = g_mime_part_new();

    g_mime_part_set_filename(p, filename);
    g_mime_message_set_mime_part(m, (GMimeObject *)p);

    print_mime(m);

    return 0;
}
</code>

I've tried this on 2.4 and 2.6, and this is the MIME it produces:

<mime>
MIME-Version: 1.0
Content-Type: text/plain; name=
Content-Disposition: attachment; filename=odt
</mime>

As you see, the filename get truncated.

I've tried debugging it, but only got as far as param_list_format(),
It's called 4 times and if I print the 'out' GString, I see that the
first two times, the output seems fine:

out: Content-Disposition: attachment; filename*0="Ferry Corsten -
Corsten's Countdown 171-200 (nic nie brakuje)."; filename*1="odt"
out: Content-Type: text/plain; name*0="Ferry Corsten - Corsten's
Countdown 171-200 (nic nie brakuje).odt"

but the next two times, it's broken:

out: Content-Type: text/plain; name=
out: Content-Disposition: attachment; filename=odt

I hope this helps somehow,  I wanted to hear your opinion before
debugging further.

Thanks!
_______________________________________________
gmime-devel-list mailing list
gmime-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gmime-devel-list



_______________________________________________
gmime-devel-list mailing list
gmime-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gmime-devel-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]