Patch: Sendmail 5.61 core dumps on long lists

Casey Leedom casey at gauss.llnl.gov
Tue Jun 5 06:22:59 AEST 1990


| From: Andy.Linton at comp.vuw.ac.nz (Andy Linton)
| 
| The problem there (and I suspect on the Mips box) is the type of value
| (size_t) returned by sizeof and strlen. 'size_t' is defined to be 'long'
| in BSD 4.3, 'int' in SunOS and 'unsigned int' in HPUX (and ANSI C).
| 
| I checked through the sendmail code and other uses of 'sizeof' and
| 'strlen' are written to avoid this problem - good luck rather than judgement?

  No, the problem was because the test was:

	sizeof(foo) - int expression < 0

Sizeof returns unsigned which gives us:

	unsigned expression - int expression < 0

which type promoting turns into:

	unsigned expression < 0

which can never be true.  As far as I know ANSI C has not changed anything
that would affect this.



More information about the Comp.bugs.4bsd.ucb-fixes mailing list