Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site ucsfcgl.UUCP
Path: utzoo!watmath!clyde!burl!hou3c!hocda!houxm!mhuxj!ulysses!allegra!mit-eddie!genrad!decvax!ucbvax!ucsfcgl!gregc
From: gregc@ucsfcgl.UUCP (Greg Couch%CGL)
Newsgroups: net.bugs.4bsd
Subject: simple bug in tp as distributed
Message-ID: <347@ucsfcgl.UUCP>
Date: Tue, 18-Sep-84 20:09:22 EDT
Article-I.D.: ucsfcgl.347
Posted: Tue Sep 18 20:09:22 1984
Date-Received: Tue, 25-Sep-84 19:38:05 EDT
Distribution: net
Organization: Computer Graphics Lab, San Francisco
Lines: 24

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) {