This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gets is not too dangerous
- From: Jon Masters <jonathan at jonmasters dot org>
- To: Miguel Angel Champin Catalan <mchampin at alumnos dot inf dot utfsm dot cl>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 04 Sep 2006 02:12:36 +0100
- Subject: Re: gets is not too dangerous
- References: <44F75A10.8060805@alumnos.inf.utfsm.cl>
On Thu, 2006-08-31 at 17:52 -0400, Miguel Angel Champin Catalan wrote:
> We are students of computer sciences in the Santa Maria University,
> Chile. We just want to know if the function "gets" it's too dangerous
> for a warning. The fact is that our teacher's assistant give us a
> homework, and one restriction was to use gcc to compile our code,
> without warnings.
As others said, it's not GCC directly giving you the warning. But
nonetheless, it's good to understand where your logic is flawed.
> We ask you for a simple explanation (if it's possible) about our
> warning, telling that "gets" is not too dangerous, because in our case,
> works perfectly, under some restrictions obviously.
Simply reading the man page states:
No check for buffer overrun is performed (see BUGS below).
Hopefully, you know what a buffer overrun/overflow is and understand why
it is therefore a very bad idea to be using gets even in academic work.
Cheers!
Jon.