Path: utzoo!attcan!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.lang.c Subject: Re: gets(3) nonsense Message-ID: <434@auspex.UUCP> Date: 11 Nov 88 17:47:45 GMT References: <867@cernvax.UUCP> <645@quintus.UUCP> <339@igor.Rational.COM> <14447@mimsy.UUCP> <1643@solo11.cs.vu.nl> Reply-To: guy@auspex.UUCP (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 15 >And now the real point: let's stop complaining about the gets(3) semantics of >not checking buffer boundaries; this is precisely what was intended. "Intended" in what sense? Somebody put it in there so that people would deliberately write programs using it, and thus would write programs that could be made to fail by sending them lines longer than they expect? Or somebody put it in there so that you could avoid the nasty run-time overhead of checking string bounds? The former is not a good reason for doing something, so the complaints are justified; the latter isn't all that good either, since 1) I suspect the cost of checking the string bounds is pretty low and 2) most of the applications I know of that read input have no control over the form of the input, and thus could be made to exhibit buggy behavior, if they used "gets()", just by handing them a line longer than they expect.