[5071] in Athena Bugs
more on sendmail bug from comp.bugs.4bsd
daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Mon Jun 4 20:05:08 1990
Date: Mon, 4 Jun 90 20:04:57 -0400
From: Jonathan I. Kamens <jik@PIT-MANAGER.MIT.EDU>
To: bugs@ATHENA.MIT.EDU
In-Reply-To: bugs[5018]
In article <60685@lll-winken.LLNL.GOV>, casey@gauss.llnl.gov (Casey
Leedom) writes:
|> | From: Andy.Linton@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.
Jonathan Kamens USnail:
MIT Project Athena 11 Ashford Terrace
jik@Athena.MIT.EDU Allston, MA 02134
Office: 617-253-8495 Home: 617-782-0710