There's a problem with 2.0.1b.
In A4FI_HEADER you copy headers to 'textline' variable with length of 1001.
You assume that incoming headers have less length. And you dont even check it.
I think that sendmail assembles multiline headers so length can actually be much more than 1001. So 2.0.1b just causes a segmentation fault.
Here's my patch:
------
# diff -u avastmilter.c.orig avastmilter.c
--- avastmilter.c.orig Thu Dec 1 11:39:10 2005
+++ avastmilter.c Sat Dec 24 05:47:08 2005
@@ -383,7 +383,7 @@
{
struct a4fiPriv *priv;
int errval;
- char textline[SMTPPROTOCOL_MAXTEXTLINE+1];
+ const char *splitter = ": ";
ssize_t nwritten;
priv = (struct a4fiPriv*)smfi_getpriv( ctx );
@@ -392,12 +392,11 @@
return SMFIS_TEMPFAIL;
}
- strcpy( textline, headerf );
- strcat( textline, ": " );
- strcat( textline, headerv );
- strcat( textline, STR_CRLF );
-
- if( file_write( priv->fd, textline, strlen(textline), &nwritten, &errval ) == -1 ) {
+ if( file_write( priv->fd, headerf, strlen(headerf), &nwritten, &errval ) == -1 ||
+ file_write( priv->fd, splitter, strlen(splitter), &nwritten, &errval ) == -1 ||
+ file_write( priv->fd, headerv, strlen(headerv), &nwritten, &errval ) == -1 ||
+ file_write( priv->fd, STR_CRLF, strlen(STR_CRLF), &nwritten, &errval ) == -1
+ ) {
char errstr[128];
errorstring( errval, errstr, sizeof(errstr) );
syslog( LOG_ERR, "data write error: %s", errstr );
------