*BSD News Article 18530


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!sol.ctr.columbia.edu!caen!usenet.coe.montana.edu!bsd.coe.montana.edu!root
From: root@bsd.coe.montana.edu (Superuser)
Newsgroups: comp.os.386bsd.questions
Subject: Re: nn
Date: 16 Jul 1993 23:40:30 GMT
Organization: Montana State University
Lines: 18
Message-ID: <227e9e$2hj@pdq.coe.montana.edu>
References: <226q88INN56k@xs4all.hacktic.nl>
NNTP-Posting-Host: bsd.coe.montana.edu

In article <226q88INN56k@xs4all.hacktic.nl> cor@hacktic.nl (Cor) writes:

[ 
 NN writes to the screen "warning: this program uses gets(), which is unsafe."
]

>Do we really need this message in gets.c?

gets() does not check to make sure that you can put all of the line into
the buffer you send it.

It's better to use fgets(), which allows you to tell it how big the buffer
is.

So, change nn to use fgets and your problems will go away.

Nate