Author Topic: avast! for sendmail/milter  (Read 5504 times)

0 Members and 1 Guest are viewing this topic.

Dublin

  • Guest
avast! for sendmail/milter
« on: October 07, 2005, 03:47:01 PM »
hi all,
the beta package integrating avast! into sendmail is available at:

http://www2.asw.cz/~mensik/avast4milter-2.0.0b.tar.gz

Dublin

  • Guest
Re: avast! for sendmail/milter
« Reply #1 on: December 01, 2005, 08:17:33 PM »

mrd000

  • Guest
Re: avast! for sendmail/milter
« Reply #2 on: December 24, 2005, 11:48:16 AM »
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 );
------
« Last Edit: December 24, 2005, 11:53:47 AM by mrd000 »

Dublin

  • Guest