Path: utzoo!attcan!uunet!munnari!basser!john From: john@basser.oz (John Mackin) Newsgroups: comp.sources.d Subject: Re: v05i053: A "safe" replacement for gets() Summary: don't try this at home, kiddies Message-ID: <1623@basser.oz> Date: 18 Nov 88 13:10:41 GMT References: <674@quintus.UUCP> Organization: Dept of Comp Sci, Uni of Sydney, Australia Lines: 32 In article <674@quintus.UUCP>, Brandon Allbery writes: > Posting-number: Volume 5, Issue 53 > Submitted-by: "A. Nonymous" > Archive-name: getsafe > > [Aaaaagh. I always suspected gets() was a potential bomb. How about > > #define gets(s) fgets(s, sizeof s, stdin) > > as a quick fix? ++bsa] Just in case anyone is actually considering doing this, I thought I had better point out it is a total disaster. As in: char *p; ... gets(p); which under Brandon's suggestion will expand to fgets(p, sizeof p, stdin) which is very unlikely indeed to do what anyone would want. John Mackin, Basser Department of Computer Science, University of Sydney, Sydney, Australia john@basser.oz.AU (john%basser.oz.AU@UUNET.UU.NET) {uunet,mcvax,ukc,nttlab}!munnari!basser.oz!john