Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!purdue!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.unix.wizards Subject: Re: free() boundary checking Keywords: free,memory Message-ID: <23016@mimsy.umd.edu> Date: 10 Mar 90 06:37:23 GMT References: <25@nixeid.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 16 In article <25@nixeid.UUCP> keogh@nixeid.UUCP (Paul Keogh) writes: >... code ... lifted from the csh source ... would crash ... [in] malloc ... >... equivalent csh code called a routine called xfree(): [with] xfree(c) char *c; { if (c >= end && c < (char *) &c) free(c); } >Why is this check necessary? The check is necessary because Bill Joy was lazy. The csh globbing code is wrong (or, if you prefer, `machine dependent'). xfree() is a hack to compensate for this. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris