[news.software.b] inews B 2.11.17 trashes articles, core dumps +FIX

gordon@sneaky.TANDY.COM (Gordon Burditt) (02/23/89)

Index:  B news 2.11.17 src/ifuncs.c

Since patch 15-17 (singular intended) indicated that there would be no 
more official patches, I'm posting this here.

Description:  Under at least some implementations of stdio, inews trashes 
	articles, generates spurious "linecount expected 55, got 287" messages 
	on almost every article, and core dumps occasionally due to a trashed
	malloc free list.
Repeat-by:  On Xenix/68000 System III (Tandy Xenix 3.2), feed a batch of
	news (compressed or not) into inews.  Observe articles with the
	same chunk repeated many times, core files, and linecount expected
	messages in the log.
Fix:  Tell stdio to quit using the buffer supplied for infp before free()ing
	it.  Apply the following patch.

*** ifuncs.c Feb 23 01:46:00 1989
--- ifuncs.c.new Feb 23 01:46:13 1989
***************
*** 1398,1404
  					} else	/* supstitute temp file as
  						 * input */
  						freopen(tfilename, "r", infp);
! 					(void) free(cp);
  					return;	/* from checkbatch as if
  						 * normal article */
  				}

--- 1398,1406 -----
  					} else	/* supstitute temp file as
  						 * input */
  						freopen(tfilename, "r", infp);
! 					/*quit using buffer before freeing it*/
! 					setbuf(infp, (char *) NULL);
! 					(void) free(cp); 
  					return;	/* from checkbatch as if
  						 * normal article */
  				}