Path: utzoo!attcan!uunet!husc6!mailrus!ames!claris!apple!desnoyer From: desnoyer@Apple.COM (Peter Desnoyers) Newsgroups: comp.lang.c Subject: Re: retiring gets(3) Message-ID: <20588@apple.Apple.COM> Date: 14 Nov 88 17:25:32 GMT References: <8841@smoke.BRL.MIL> <1988Nov11.232629.15414@utstat.uucp> Organization: Apple Computer Inc, Cupertino, CA Lines: 12 Perhaps I'm being naive, but wouldn't changing char buf[x]; gets( buf); to char * buf; buf = malloc( x); gets( buf); eliminate most (not all) of the security hole associated with gets()? The problem seems to be not only the use of gets(), but the use of temporary arrays on the stack to hold the output of dangerous functions. If you keep the buffer off the stack you make it much more difficult to exploit gets()'s unsafeness. (unless all you want to do is make the program crash.) Peter Desnoyers