Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!lll-winken!gauss.llnl.gov!casey From: casey@gauss.llnl.gov (Casey Leedom) Newsgroups: comp.bugs.4bsd Subject: Re: Patch: Sendmail 5.61 core dumps on long lists Message-ID: <60685@lll-winken.LLNL.GOV> Date: 4 Jun 90 20:22:59 GMT References: <432@ria.ccs.uwo.ca> <1990May30.221516.6077@comp.vuw.ac.nz> Sender: usenet@lll-winken.LLNL.GOV Reply-To: casey@gauss.llnl.gov (Casey Leedom) Organization: Lawrence Livermore National Laboratory Lines: 23 | 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.