procmail
[Top] [All Lists]

Re: This tiny script causes a segmentation fault..

2004-07-28 01:15:17
On Sat, Jul 24, 2004 at 12:49:37AM -0600, Justin Gombos wrote:
* Justin Gombos <mindfuq(_at_)zianet(_dot_)com> [2004-07-23 23:26]:
MAILDIR=./
DEFAULT=$MAILDIR/default_box
LOGFILE=$MAILDIR/procmail.log
VERBOSE=1

LINEBUF=128

SOME_BYTES=(\
11111111111111111111|\
22222222222222222222)

:0 :
*$ !^TO_$SOME_BYTES
mailbox

BTW- the system variable TO_ consumes 96 bytes.  So the user defined
variable $SOME_BYTES probably only needs to be ~35 bytes to crash
(assuming a LINEBUF of 128).

I also noticed I get different kinds of crashes depending on how much
I exceed the LINEBUF.  The above example causes a segmentation fault,
but if I increase the size of $SOME_BYTES from 42 to something over
120, I get persistent lock files and timeouts instead.

I am unable to reproduce your results.  In fact, the above 
recipe in my test harness (from your LINEBUF assignment on)
does not overrun for me.

When I increase length of $SOME_BYTES I can cause a buffer overrun,
of course.  Here is a log snippet with that accomplished:

 procmail: Assigning "LINEBUF=128"
 procmail: Exceeded LINEBUF
 procmail: Assigning "PROCMAIL_OVERFLOW=yes"
 procmail: No match on ! [...]

But also notice the fair warning.  That is, of course, with verbose
logging on.  With verbose logging off, I get only this warning

 procmail: Exceeded LINEBUF

which still is enough to tell me something's up.

In fact, I need this length

SOME_BYTES=(\
00000000000|\
11111111111111111111|\
11111111111111111111|\
11111111111111111111|\
11111111111111111111|\
22222222222222222222)

to get to a problem (sorry I did not bother to renumber in the pretty
fashion you did -- I just copied and replicated your first line, then
added the 00's until I got an overrun).  I get the same warnings in
the log and the same behavior regarless of whether I exceed LINEBUFF
by one char or many more.

What version of procmail are you using again?

I am curious about what you experience, but can't duplicate it.  So
if your version is modern, it must be peculiar to your platform/build.

If you feel like it, you could download my diagnostics plug-in rc and
run it via an INCLUDERC after the buffer overrun.  You will
get something like this:

 ==================================================================
 Environment Self-Test for Procmail, Courtesy of Virus Snaggers(tm)
 ==================================================================
 * uname -a:
                 NetBSD panix5.panix.com 1.6.2 NetBSD 1.6.2
                 (PANIX-USER) #0: Tue Mar 16 21:50:26 EST 2004
                 
root(_at_)trinity(_dot_)nyc(_dot_)access(_dot_)net:/devel/netbsd/1.6.2/src/sys/arch/i386/compile/PANIX-USER
                 i386
 ------------------------------------------------------------------
    Procmail settings and states:
 ------------------------------------------------------------------
 * procmail      /net/u/1/d/dman/bin/procmail
 * $$:           19173
 * $=:           0
 * $?:           0
 * $_:           /htdocs/userdirs/dman/vdoms/parve/vsnag/beta/vsnag.self-test.rc
 * COMSAT:       no
 * DEFAULT:      /dev/null
 * DELIVERED:    -
 * DROPPRIVS:    -
 * EXITCODE:     -
 * HOME:         /net/u/1/d/dman
 * HOST:         panix5.panix.com
 * INCLUDERC:    /htdocs/userdirs/dman/vdoms/parve/vsnag/beta/vsnag.self-test.rc
 * LASTFOLDER:   -
 * LINEBUF:      128
 * LOCKEXT:      .lock
 * LOCKFILE:     -
 * LOCKSLEEP:    -
 * LOCKTIMEOUT:  -
 * LOGABSTRACT:  all
 * LOGFILE:      /dev/stderr
 * LOGNAME:      dman
 * MATCH:        DUMMY
 * MAILDIR:      /net/u/1/d/dman/Mail
 * MSGPREFIX:    msg.
 * NORESRETRY:   -
 * ORGMAIL:      /net/u/1/d/dman/.maildir/
 * PATH:         /net/u/1/d/dman/bin:/bin:/usr/local/bin:/usr/bin
 * PDIR:         /net/u/1/d/dman/.procmail
 * PROCMAIL_OVERFLOW: yes
 * PROCMAIL_VERSION: 3.23pre+
 * SENDMAIL:     /usr/sbin/sendmail
 * SENDMAILFLAGS: -oi
 * SHELL:        /bin/sh
 * SHELLFLAGS:   -c
 * SHELLMETAS:   &|<>~;?*[
 * SUSPEND:      -
 * SWITCHRC:     -
 * TIMEOUT:      -
 * TZ:           Europe/Berlin
 * UMASK:        077
 * VERBOSE:      off
 ==================================================================


Notice the value of LINEBUF and PROCMAIL_OVERFLOW especially.

You can get the self-test.rc in the download area at <http://vsnag.spamless.us>.

-- 
dman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail