Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Oct 1997 07:07:33 -0500 (EST)
From:      Brian Mitchell <brian@firehouse.net>
To:        Jacques Hugo <jacques@wired.ctech.ac.za>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: gets
Message-ID:  <Pine.BSI.3.95.971029070613.21092A-100000@shell.firehouse.net>
In-Reply-To: <3456E072.794BDF32@wired.ctech.ac.za>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 29 Oct 1997, Jacques Hugo wrote:

> Hi there ...
> 
> Whenever I use gets(3) to read from
> stdin, I get 
> 
> warning: this program uses gets(), which is unsafe. 

in a privledged program, this will very likely let someone overwrite the
stack (depending on what kind of pointer you pass to it).

> 
> 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.
> 

use fgets() -- pass stdin to it, remember to remove the \n if it is
present.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSI.3.95.971029070613.21092A-100000>