retiring gets(3)

John A. Ebersold vfm6066 at dsacg3.UUCP
Thu Nov 10 02:48:19 AEST 1988


In article <1031 at cps3xx.UUCP> usenet at cps3xx.UUCP (Usenet file owner) writes:
>
>This may be a naive question, or perhaps I haven't followed the right
>stories, but what is the problem with using gets versus fgets?
>

One can feed a VERY long string to gets(3), since gets will keep reading
characters until receipt of a newline and does not check for overflow of the
receiving buffer.  The VERY long string would cause a program to
malfunction is some way that is not clear to me.

Maybe overwritting the stack?



More information about the Comp.lang.c mailing list