Bogofilter-0.92.0 segfaults on freebsd with `%I' in "header_format"

David Relson relson at osagesoftware.com
Mon Jun 28 15:32:47 CEST 2004


On Mon, 28 Jun 2004 15:09:40 +0200
Clemens Fischer wrote:

> problem:  in bogofilter.cf use "header_format = %h: %c,
> tests=bogofilter, spamicity=%p, IP=%I, version=%v" and watch
> bogofilter segfault.  the last syscall completed is
> `sysctl([hw.floatingpoint], ...)':

...[snip]...

Hi Clemens,

Please gzip the message and send it to me.  The problem is most
certainly that bogofilter didn't find the spam address and is trying to
use a NULL pointer with '%I'.

By the way, I'm considering changing the format spec from '%I' (for IP
address) to '%S' for spam address, which seems like a better name. 
What's your opinion?

Note: Address bogofilter at aotto.com is obsolete.  The address is now
bogofilter at bogofilter.org..

I'm heading off to my day job now.  I'll get back to you on this later.

David

PS:  Here's a patch for you to try:

--- format.c	14 Jun 2004 23:45:44 -0000	1.37
+++ format.c	28 Jun 2004 13:30:32 -0000
@@ -357,8 +357,11 @@
 		buff += format_string(buff, spam_header_name, 0, prec, flags,
end);
 		break;
 	    case 'I':		/* I - received IP address */
-		buff += format_string(buff, ipaddr->text, 0, prec, flags, end);
-		break;
+	    {
+		const char *addr = (const char *) (ipaddr->text  ? ipaddr->text
: "*none*");
+		buff += format_string(buff, addr, 0, prec, flags, end);
+	    }
+	    break;
 	    case 'l':		/* l - logging tag */
 		buff += format_string(buff, logtag, 0, prec, flags, end);
 		break;




More information about the Bogofilter mailing list