*BSD News Article 18769


Return to BSD News archive

From: uhclem@nemesis.UUCP
Date: 22 Jul 93 20:10 CDT
Newsgroups: comp.os.386bsd.questions
Subject: Re: Using gets() [ Was Re: nn ]
Message-ID: <-21066806@nemesis>
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!haven.umd.edu!uunet!olivea!pagesat!spssig.spss.com!news.oc.com!utacfd.uta.edu!trsvax!trsvax!nemesis!uhclem
Nf-ID: #R:<229qig$53k@pdq.coe.montana.edu>:-32:nemesis:-21066806:000:993
Nf-From: nemesis.UUCP!uhclem    Jul 22 20:10:00 1993
References: <229qig$53k@pdq.coe.montana.edu>
Lines: 20


<>
[0]>There is nothing wrong with using gets if there is no good reason for
[0]>input to be longer than some limit.  Like, a response to a yes/no
[0]>question is very unlikely to be longer than 8 characters.  If a user
[0]>wants to break the program, he is welcome to do so (unless it's suid
[0]>or a daemon). I would just compile nn with my own version of gets:

Well, if you were in the college C course I taught, you would have lost points
each time you used gets().  Code should be designed to be crash-resistant,
and that means the code should avoid doing or using things that can cause
failures that can easily be avoided.   Gets() falls in the "you are asking
for it" category.

Frank Durda IV <uhclem@nemesis.lonestar.org>|"The federal agents are exposing
...utacfd!nemesis!uhclem (nearest internet) | themselves to the outer 
...letni!rwsys!nemesis!uhclem	            | atmosphere." - KXAS news reporter
...decvax!microsoft!trsvax!nemesis!uhclem   | during Waco Texas fire. Really!