[gmime-devel] Header folding issue



Hey,

If a header is:
 a. longer than fold length
 b. has no obvious folding spot
(e.g a string with 70 straight "A" chars)

when it gets unfolded, there's an extra \t char in the folding spot.

code to reproduce:

<code>
	GMimeMessage *message0;
	GMimeMessage *message1;
	GMimeParser  *parser;
	GMimeStream  *stream;

	g_mime_init(0);
	
	stream = g_mime_stream_mem_new();

        message0 = g_mime_message_new(0);
        g_mime_message_set_subject(message0,
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
        g_mime_object_write_to_stream((GMimeObject *)message0, stream);

        g_mime_stream_reset(stream);

	parser = g_mime_parser_new_with_stream(stream);
	message1 = g_mime_parser_construct_message (parser);

        printf("%s\n", g_mime_message_get_subject(message0));
        printf("%s\n", g_mime_message_get_subject(message1));
<code>

result:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa	a


As you see, after folding an unfolding, the subject has an extra \t
before the last "a" and doesn't match the original subject.
P.S. If I introduce a space in the subject, the folding/unfolding
finds where to split it and works correctly.

(Tested with 2.4 and 2.6)

Thanks!


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