-B option, MH folders

David Relson relson at osagesoftware.com
Tue Sep 2 15:48:02 CEST 2003


On Tue, 02 Sep 2003 09:33:59 -0400
Jason Rennie <jrennie at ai.mit.edu> wrote:

> I'm trying to get bogofilter to train on my collection of MH mail. 
> I'm using the -B option as suggested by David Relson.  It seems that
> there is a bug in the code that reads in the strings from the command
> line.  If I run
> 
>   bogofilter -d /tmp/.bogofilter -n -vt -B
>   /home/ai2/jrennie/Mail/mlists/gnucash
>   /home/ai2/jrennie/Mail/mlists/jmlr
> 
> bogofilter reports this error:
> 
>   cannot open directory '/home/ai2/jrennie/Mail/mlists/jmlrash': No
>   such file or directorySegmentation fault
> 
> Looks like it's writing "/home...jmlr" to the same location as the 
> previous folder name and not writing a \0 termination character. 
> Though, I don't know the code, so this is just a guess.

And a very good guess it is!  Try the patch below:


--- bogoreader.c	2 Sep 2003 00:10:39 -0000	1.20
+++ bogoreader.c	2 Sep 2003 13:46:54 -0000
@@ -97,7 +97,8 @@
     l = min(l, sizeof(dirname)-2);
     memcpy(dirname, name, l);
     if (dirname[l-1] == '/')
-	dirname[l-1] = '\0';
+	l -= 1;
+    dirname[l] = '\0';
 }
 
 static const char* const maildir_subs[]={ "/new", "/cur", NULL };





More information about the Bogofilter mailing list