This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gets is not too dangerous


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]