free() boundary checking

Chris Torek chris at mimsy.umd.edu
Sat Mar 10 16:37:23 AEST 1990


In article <25 at nixeid.UUCP> keogh at 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 at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.wizards mailing list