Bug when removing folded X-Bogosity header

Martin Ouwehand see.URL at end.of.message
Tue Mar 25 14:26:22 CET 2003


There is a bug in bogofilter-0.11.1.3/src/main.c when removing folded
(i.e. multi-line) X-Bogosity headers like this:

A-header: blabla
X-Bogosity: this is a header
                contrived by a bad guy to annoy you
Another-header: blabla

bogofilter -p will reformat this incorrectly, like this:

A-header: blabla
                contrived by a bad guy to annoy you
Another-header: blabla


Here's a patch:

diff -ru bogofilter-0.11.1.3.orig/src/main.c bogofilter-0.11.1.3/src/main.c
--- bogofilter-0.11.1.3.orig/src/main.c	Sun Mar  9 03:14:56 2003
+++ bogofilter-0.11.1.3/src/main.c	Tue Mar 25 14:23:08 2003
@@ -235,15 +235,20 @@
 	/* print headers */
 	while ((rd = rf(&out, rfarg)) > 0)
 	{
+	    /* skip over spam_header ("X-Bogosity:") lines */
+	    if (rd >= bogolen && memcmp(out, spam_header_name, bogolen) == 0) {
+		while (((rd = rf(&out, rfarg)) > 0) &&
+					(out[0] == ' ' || out[0] == '\t') )
+		    /* empty loop */ ;
+		if (rd <= 0)
+		    break;
+	    }
+
 	    /* detect end of headers */
 	    if ((rd == 1 && memcmp(out, NL, 1) == 0) ||
 		(rd == 2 && memcmp(out, CRLF, 2) == 0)) {
 		break;
 	    }
-
-	    /* skip over spam_header ("X-Bogosity:") lines */
-	    if (rd >= bogolen && memcmp(out, spam_header_name, bogolen) == 0)
-		continue;
 
 	    /* rewrite "Subject: " line */
 	    if (rd >= subjlen && 

--
  | ~~~~~~~~ Martin Ouwehand ~ Swiss Federal Institute of Technology ~ Lausanne
__|_____________ Email/PGP: http://slwww.epfl.ch/info/Martin.html _____________
L'ennui quand on voit la contrainte c'est
qu'on ne voit plus que la contrainte...                         [Georges Perec]





More information about the bogofilter-dev mailing list