Posted by Chung Leong on 08/16/06 03:30
Keith Thompson wrote:
> ARGH!
>
> What I meant to write was:
>
> No, it's *not* ok to use gets().
>
> Never. Never ever.
>
> Use fgets() (and watch out for the trailing '\n'). Or read a
> character at a time. Or use some custom routine like ggets().
>
> gets(), for all practical purposes, cannot be used safely. It is a
> buffer overflow waiting to happen.
Well, there is Secure Template Overloads in VC8
(http://msdn2.microsoft.com/en-us/library/ms175759.aspx). Sort of a
pointless feature since a typical C program won't combine as C++
without heavy modification. Anyway, this is totally off topic.
[Back to original message]
|