[ale] gets() in C++

Fletch fletch at phydeaux.org
Tue Jun 27 16:52:42 EDT 2000


>>>>> "David" == David S Jackson <dsj at dsj.net> writes:

    David> Can anyone tell me why using gets() in C++ might be unsafe?
    David> When I compile a C++ program using it I get a warning from
    David> a compiler in FreeBSD that says: Program uses gets(); this
    David> might be unsafe.

        Well, the manual page for gets(3) says:


BUGS
       Because it is impossible to tell without knowing the  data
       in  advance  how  many  characters  gets()  will read, and
       because gets() will continue to store characters past  the
       end  of  the buffer, it is extremely dangerous to use.  It
       has been used to break  computer  security.   Use  fgets()
       instead.

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
678 443-6239(w)       |  scary questions." -- Jules                =(___)=
                      |                                               U
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.





More information about the Ale mailing list