Re: gets

[ Available lists | Index of freebsd-hackers | Month of Oct 1997 | Week of 29 Oct 1997 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Brian Mitchell <brian@firehouse.net>
Date
29 Oct 1997 04:08:30
Subject
Re: gets
Message-ID
Pine.BSI.3.95.971029070613.21092A-100000@shell.firehouse.net

In reply to

[ Hide this part ]
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.




Elapsed time: 0.076 seconds