From owner-freebsd-hackers Wed Oct 29 04:08:30 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id EAA12138 for hackers-outgoing; Wed, 29 Oct 1997 04:08:30 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from shell.firehouse.net (brian@shell.firehouse.net [209.42.203.45]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id EAA12131 for ; Wed, 29 Oct 1997 04:08:25 -0800 (PST) (envelope-from brian@shell.firehouse.net) Received: from localhost (brian@localhost) by shell.firehouse.net (8.8.5/8.8.5) with SMTP id HAA21096; Wed, 29 Oct 1997 07:07:35 -0500 (EST) Date: Wed, 29 Oct 1997 07:07:33 -0500 (EST) From: Brian Mitchell To: Jacques Hugo cc: hackers@FreeBSD.ORG Subject: Re: gets In-Reply-To: <3456E072.794BDF32@wired.ctech.ac.za> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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.