I need help with this structure loop(?)

Chris Torek torek at elf.ee.lbl.gov
Sun Jun 2 22:10:39 AEST 1991


In article <1991Jun1.205224.27309 at thunder.mcrcim.mcgill.edu>
mouse at 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 at ee.lbl.gov



More information about the Comp.lang.c mailing list