Thread View: news.software.readers
1 messages
1 total messages
Started by Thomas Schultz
Tue, 04 Jan 2000 00:00
[slrn] Bug: segfault when viewing some messages
Author: Thomas Schultz
Date: Tue, 04 Jan 2000 00:00
Date: Tue, 04 Jan 2000 00:00
93 lines
3343 bytes
3343 bytes
Hi,
If you open the article I just posted (Subject: "Reading this message
might crash slrn!"), slrn will probably segfault. If it doesn't, your
configuration is different from the one described in this article
(use_mime=1; wrap_flags>=4; SCREEN_WIDTH <= ~100). Here is why:
On the server, the message looks like this:
v-SCREEN_WIDTH about here
xxxx xxxxxx xxxxxx xxxxx xxxxx =
xxxxxx
As (wrap_flags & 0x4) is true and the first line is longer than
SCREEN_WIDTH, slrn immediatly wraps the line, so the message looks
like this:
xxxx xxxxxx xxxxxx
xxxxx xxxxx =
xxxxxx
Now, the message is MIME decoded; '=' at the end of a line indicates a
"soft" line break in quoted printable messages, so slrn merges lines
two and three; the message looks like this:
xxxx xxxxxx xxxxxx
xxxxx xxxxx xxxxxx
When trying to unwrap the first line, slrn simply tries to strcpy()
the contents of line two to the end of line one. Usually, this works,
as there is still enough memory for the operation; in this case,
however, line two has become larger since the wrapping has been done,
so strcpy() tries to write beyond the malloc()ed memory of line one.
I think this problem should be solved by unwrapping the article before
doing the MIME decoding. This patch does just that and fixes the bug:
--- mime.c~ Sun Dec 19 22:51:32 1999
+++ mime.c Tue Jan 4 23:09:53 2000
@@ -563,20 +563,31 @@
void slrn_mime_process_article (Slrn_Article_Type *a)
{
+ int is_wrapped;
+
if ((Slrn_Use_Mime == 0)
|| Slrn_Mime_Was_Parsed
|| (a == NULL))
return;
+
+ is_wrapped = a->is_wrapped;
+ if (is_wrapped) _slrn_art_unwrap_article(a);
Slrn_Mime_Was_Parsed = 1; /* or will be */
rfc1522_decode_headers (a);
- if (NULL == find_header_line (a, "Mime-Version:")) return;
+ if (NULL == find_header_line (a, "Mime-Version:"))
+ {
+ if (is_wrapped) _slrn_art_wrap_article(a);
+ return;
+ }
+
if ((-1 == parse_content_type_line (a))
|| (-1 == parse_content_transfer_encoding_line (a)))
{
Slrn_Mime_Needs_Metamail = 1;
+ if (is_wrapped) _slrn_art_wrap_article(a);
return;
}
@@ -586,6 +597,7 @@
case ENCODED_8BIT:
case ENCODED_BINARY:
/* Already done. */
+ if (is_wrapped) _slrn_art_wrap_article(a);
return;
case ENCODED_BASE64:
@@ -598,8 +610,10 @@
default:
Slrn_Mime_Needs_Metamail = 1;
+ if (is_wrapped) _slrn_art_wrap_article(a);
return;
}
+ if (is_wrapped) _slrn_art_wrap_article(a);
}
#ifndef MAXPATHLEN
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads