[net.bugs.4bsd] simple bug in tp as distributed

gregc@ucsfcgl.UUCP (Greg Couch%CGL) (09/19/84)

Here's the bug report I sent in to Berkeley:

Subject: There is a very simple bug in tp as distributed
Index:	bin/tp/tp1.c 4.2BSD

Description:
	tp core dumps.

Repeat-By:
	I did it by doing a "tp mt0" on a ancient tp format tape.

Fix:
	Someone temporarily forgot his C precedence rules when changing
	tp to use malloc instead of sbrk (as it did in v7).  That change
	was so tp could use the directory access routines in the standard
	library, which use malloc.

	The fix is to add a set of parenthesis to force the assignment to
	nptr to be done before the comparison.  Here is the diff:

	180c180
	< 		if (nptr = realloc(nptr, 2 * size) == 0) {
	---
	> 		if ((nptr = realloc(nptr, 2 * size)) == 0) {