*BSD News Article 33259


Return to BSD News archive

Xref: sserve comp.os.386bsd.questions:11800 comp.os.386bsd.development:2339 comp.os.386bsd.misc:2817
Newsgroups: comp.os.386bsd.questions,comp.os.386bsd.development,comp.os.386bsd.misc
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!EU.net!uknet!festival!edcogsci!richard
From: richard@cogsci.ed.ac.uk (Richard Tobin)
Subject: Re: Why does FreeBSD 1.1.5 say gets() is unsafe?
Message-ID: <CtJoDs.Iwz@cogsci.ed.ac.uk>
Organization: HCRC, University of Edinburgh
References: <ASAMI.94Jul21184711@forgery.cs.berkeley.edu> <31181v$ibk@agate.berkeley.edu> <ASAMI.94Jul25151654@forgery.cs.berkeley.edu>
Date: Tue, 26 Jul 1994 11:10:40 GMT
Lines: 12

In article <ASAMI.94Jul25151654@forgery.cs.berkeley.edu> asami@cs.berkeley.edu (Satoshi ASAMI) writes:
>Hmm, so how can you write a program that uses gets() and is safe?

By only using it to read data that you know is of the right length (eg
because you've written it, or because it's on punched cards).

-- Richard
-- 
Richard Tobin, HCRC, Edinburgh University                 R.Tobin@ed.ac.uk

Ooooh!  I didn't know we had a king.  I thought we were an
autonomous collective.