gets(3) nonsense
Guy Harris
guy at auspex.UUCP
Wed Nov 16 03:27:22 AEST 1988
>\"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?
>
>Hey people! I just found out somebody put a nasty little program in /bin!
>It's called `rm'. If you type `rm *', all your files will disappear!
You've totally missed the point.
Somebody might want all the files in a given directory to disappear. I
have difficulty imagining anybody who *wants* to write a program that
blows up when you feed too-long lines at it.
>\Or somebody put it in there so that you could avoid the nasty run-time
>\overhead of checking string bounds?
>
>Of course!
"Of course somebody put it in so you can avoide string bounds checking?"
I dispute this. Got any references handy to prove your assertion?
>If you want security, use fgets()!
I want security. I want everyone *else* to want security. I don't want
programs that die randomly if they get handed lines that are too long.
Programs like that are rude.
More information about the Comp.lang.c
mailing list