retiring gets(3)

Richard A. O'Keefe ok at quintus.uucp
Wed Nov 16 12:03:44 AEST 1988


In article <1988Nov14.220842.3980 at utstat.uucp> geoff at utstat.uucp (Geoff Collyer) writes:
>Any program which uses gets(3) can be corrupted by giving it a
>long-enough input line.  There is no protection possible against such an
>attack

There is a false assumption in this, namely that an attacker can control
the input to every program.  If I have a program which _only_ I have
permision to execute, and I _always_ use it in a pipeline (or in a
command script), and the preceding program in the pipeline (or script)
always generates sufficiently short lines, it is safe to use gets().
The input to such a program is _every_ bit as much under my control as
the source argument of strcpy().



More information about the Comp.lang.c mailing list