Package: renattach Version: 1.2.2-1 I have an email virus checker that quarantines suspect messages. When notifying the recipient of this, I add the original message as an attachment, with its attachments made harmless by renattach --all --delete. So far, this has worked great.
The virus message attached to this message, however, has an empty line inside the attachment. This makes renattach stop discarding the attachment, letting the empty line and everything after it through. And this makes the virus checker trigger again, sending a new notification, which starts with an empty line, which makes renattach let the empty line and everything after it through. And we get a mail loop. Attached is a patch that makes this immediate problem go away. I have no idea if it breaks something else, and renattach does not seem to have any tests I could run. Also, I think the attachment could contain lines starting with "--" that are not the MIME boundary, so it seems this bug won't be fixed this easily. It should probably skip to the next boundary, no matter what the attachment content is. The attached virus message gpg symmetrically encrypted to make it pass through any checking on the way to the bug tracking system. The passphrase is "foo", without the quotes. Just run "gpg <virus.gpg".
virus.gpg
Description: Binary data
diff --git a/src/renattach.c b/src/renattach.c index 706c54a..449aa9f 100644 --- a/src/renattach.c +++ b/src/renattach.c @@ -480,7 +480,7 @@ int filter_pass(FILE* dest) skip_encoded = 2; /* now we're actually skipping body lines */ else if (skip_encoded == 2) /* Encoded body lines will be skipped if 'deleting' an attachment. */ { - if ( (*linebuf == '\n') || (*linebuf == '\r') || (strncmp(linebuf, "--", 2)==0) ) + if ( strncmp(linebuf, "--", 2)==0 ) skip_encoded = 0; else continue;