Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!comp.vuw.ac.nz!asjl From: Andy.Linton@comp.vuw.ac.nz (Andy Linton) Newsgroups: comp.mail.sendmail Subject: 5.65+IDA running on HP300's with MOREbsd exercises fprintf() bug Message-ID: <1990Nov02.000110.9805@comp.vuw.ac.nz> Date: 2 Nov 90 00:01:10 GMT Sender: news@comp.vuw.ac.nz (News Admin) Reply-To: Andy.Linton@comp.vuw.ac.nz Organization: Computer Science Dept, Victoria Univ, Wellington, NEW ZEALAND Lines: 40 Nntp-Posting-Host: tinakori.comp.vuw.ac.nz Originator: asjl@tinakori.comp.vuw.ac.nz I suspect not too many people will be bitten by this problem but I'll give the details for those who are. Description: Blank lines in messages are duplicated. Repeat-By: Send mail with embedded blank lines from a MOREbsd HP300 system running 5.65+IDA Fix: Problem arises because putline() in util.c exercises a bug in fprintf() in the standard C library. We have notified Mt Xinu and passed a patch to them. The problem with fprintf() arises because putline() uses the following format string: fprintf(fp, "%.*s%s", p-l, l, m->m_eol); When a blank line is to be printed 'p-l' evaluates to '0' and the bug in fprintf() prints the string 'l' (which in this case contains '\n') in a field 32767 wide instead of using one which is of zero width. Subsequent code in putline() prints out another '\n' giving the duplicate blank line. The real fix is to replace fprintf() in the standard C library but use of the putline() version from 5.64 should be possible as a stop gap measure. You can test your fprint() for this problem using: #include main() { fprintf(stdout, "fprintf() %.0s%s\n", "not ", "correct"); } The output should say it all!