[net.unix-wizards] Cron dies, why ?

bernerus@chalmers.UUCP (Christer Bernerus) (01/19/84)

We're still running 4.1 BSD in a VAX11/780, for some strange reason
cron dies silently. This seems to be correlated with how heavy the
machine is loaded. I made a changed version that didn't fork, and thus
obtained a dump. This showed that cron got a segmentation fault in
malloc that was called from realloc on line 168 in cron.c.

Has anybody experienced this before ? 

chris@umcp-cs.UUCP (01/21/84)

cron has a bug in dealing with long lines in /usr/lib/crontab.
The source has a magic constant in the table reader.  On standard
4.1BSD systems this is 100.  This constant says when to allocate
more table space.  If you're down to 110 characters it won't allocate
more space; if you then read in a long (>110 char) line the table
will overflow and the *next* call to malloc (realloc) will fail
with a segmentation fault or equivalent.

The quick fix, of course, is to increase the magic constant.  If it's
1024 then you can't make a long enough line in vi to overflow the table,
so that's a pretty good value.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci
UUCP:	{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris.umcp-cs@CSNet-Relay