Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!spool.mu.edu!agate!dog.ee.lbl.gov!elf.ee.lbl.gov!torek From: torek@elf.ee.lbl.gov (Chris Torek) Newsgroups: comp.lang.c Subject: Re: I need help with this structure loop(?) Message-ID: <13816@dog.ee.lbl.gov> Date: 2 Jun 91 12:10:39 GMT Article-I.D.: dog.13816 References: <789@ra.MsState.Edu> <1991Jun1.205224.27309@thunder.mcrcim.mcgill.edu> Reply-To: torek@elf.ee.lbl.gov (Chris Torek) Distribution: usa Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 15 X-Local-Date: Sun, 2 Jun 91 05:10:39 PDT In article <1991Jun1.205224.27309@thunder.mcrcim.mcgill.edu> mouse@thunder.mcrcim.mcgill.edu (der Mouse) writes: >You shouldn't be using gets(). ... Use fgets() instead. >The reason for this is that it has no checking to prevent overrunning >the buffer passed to it, and by its very design *cannot* have any such >checking. Well, technically, it *can*; Saber-C is one example. However, it is fairly expensive to make it check (`gets' itself does not do the checking in Saber, but rather the underlying implementation; and the checking vanishes when you use precompiled code), and most implementations will not, so the above remains good advice. -- In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427) Berkeley, CA Domain: torek@ee.lbl.gov