Date: Wed, 29 Oct 1997 08:24:15 -0500 (EST) From: Gary Kendall <gdk@ccomp.inode.COM> To: Jacques Hugo <jacques@wired.ctech.ac.ZA> Cc: hackers@freebsd.ORG Subject: Re: gets Message-ID: <199710291324.IAA03379@ccomp.inode.com> In-Reply-To: <3456E072.794BDF32@wired.ctech.ac.za> from Jacques Hugo at "Oct 29, 97 09:06:26 am"
next in thread | previous in thread | raw e-mail | index | archive | help
It wasn't too long ago that Jacques Hugo said: > Hi there ... > > Whenever I use gets(3) to read from > stdin, I get > > warning: this program uses gets(), which is unsafe. > > The program works ok, no problem there. But I > don't like that error. Is there someting else > I can use, or maybe a work-around to read > from stdin. > > Thanks > > -Jacuqes > > ------------------------------------------------------ > The box said "Requires Windows 3.1 or better" > ... so I got BSD > > System Administrator | Jacques Hugo > UNIX Systems | jacques@wired.ctech.ac.za > Cape Technikon | +27-21-4603584 > ------------------------------------------------------ > You should use fgets() so you can specify the buffer size and prevent data overruns which have the potential of "writing new code" into your program. Regards, Gary Kendall %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The difficult is done immediately, the impossible takes a little longer. % %----------------------------------------------------------------------------% % gdk@ccomp.inode.com or gkendall@eddie.mit.edu % %----------------------------------------------------------------------------% % Creative Computing * 96 Forest Street * Danvers, MA 01923 * 978-777-3784 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710291324.IAA03379>