Subject: Re: gets()
To: None <Matthieu.Herrb@laas.fr, current-users@sun-lamp.cs.berkeley.edu>
From: Shao Ai Wu <m-sw2360@doc.cs.nyu.edu>
List: current-users
Date: 03/11/1994 18:08:13
>While we are into this discussion, what about implementing a kind of
>purify in NetBSD ?
>
>This would trap overflows in gets() as well as many other obscure
>bugs in memory management...
>
>[ For those who don't know purify, it's a commercial product that allows
>a run-time debugging of memory allocation problems (writing past an
>malloc'ed block or to a free'd block, freeing a block twice, reading
>uninizialized memory...) by trapping all malloc calls and all memory
>references at run time. ]
>
>
>					Matthieu

Overflow checking is easy to archieve if there is hardware help, but
it is difficult and expensive to implement it in software.    For
example, if overflow occurred within a page-frame, hardware generally,
can't help.   A software solution might be too expensive, if it works
at all (who checks for the checker?).
  
The simplier solution might be add the second argument to gets():
     char *gets (char *buffer, int size)

Shao Wu


------------------------------------------------------------------------------