SA Bugzilla – Bug 2290
Some material within base64-encoded mime boundaries ignored.
Last modified: 2004-01-27 09:50:37 UTC
In the function get_decoded_stripped_body_text_array material within a mime boundary is extracted for further processing. The material is not properly extracted when certain line endings are used. This occurs in the attached message. The code also omits any line starting with "SPAM", perhaps this code is obsolete. I'll attach a patch fixing the two problems.
Created attachment 1211 [details] Mail triggering bug.
Created attachment 1212 [details] Proposed fix. Patch was edited.
Created attachment 1213 [details] Proposed fix. Minor change to proposed fix.
I found a second bug which prevents some base64 material from being used. (get_decoded_body_text_array discards the blank line between the "Context-" lines and the base64-encoded material. A patch will be attached below. I also just noticed that I didn't mention base64 encoding in the summary or the previous comments.
Created attachment 1218 [details] Proposed fix. Patch was editted.
Created attachment 1219 [details] Mail encountering bug fixed by patch 1218. This message triggers the problem fixed by the last patch.
I've been thinking... Both bugs caused the code that's only supposed to remove the mime boundaries and part headers to also remove message text. (See the first foreach loop in PerMsgStatus::get_decoded_stripped_body_text_array.) The patch that I posted fixes the precise bugs that lead to this incorrect operation (one caused by unexpected line endings, the other by an empty line being discard) but not other potential problems that lead to unexpected placement of whitespace and headers (causing the foreach loop to remove too much text). Given that the loop is susceptible to other problems and given that the loop's only purpose is to remove stuff like: --DD381._.F.899C_ Content-Type: text/html; Content-Transfer-Encoding: base64 I think the whole loop should just be eliminated or it should just remove the boundary markers. I doubt the conventional SA rules and BC would be much effected by inclusion of the Content-Type text. I don't think the loop as it is should be retained with added safeguards such as a counter on the number of lines past the boundary, because such protections could possibly be exploited by those coveting the superior qualities of SA users.
the new mime parser has no problem with these messages.