insider.si.edu: (When Your Heart's on Fire) Smoke Gets in Your Eyes; Jealousy
Gertrude Niesen. side 1: (When Your Heart's on Fire) Smoke Gets in Your Eyes; side 2: Jealousy (Victor 24454).
I thought it is pretty cool to use the gets() function because it is like the scanf() wherein I could get an input with whitespace. But I read in one of the threads (student info file handling) tha...
Never use gets. It offers no protections against a buffer overflow vulnerability (that is, you cannot tell it how big the buffer you pass to it is, so it cannot prevent a user from entering a line larger than the buffer and clobbering memory). Avoid using scanf. If not used carefully, it can have the same buffer overflow problems as gets. Even ignoring that, it has other problems that make it ...
C - scanf () vs gets () vs fgets () - Stack Overflow
Why is gets() dangerous The first internet worm (the Morris Internet Worm) escaped about 30 years ago (1988-11-02), and it used gets() and a buffer overflow as one of its methods of propagating from system to system. The basic problem is that the function doesn't know how big the buffer is, so it continues reading until it finds a newline or encounters EOF, and may overflow the bounds of the ...
Why is the gets function so dangerous that it should not be used?
The basic difference [in reference to your particular scenario], scanf() ends taking input upon encountering a whitespace, newline or EOF gets() considers a whitespace as a part of the input string and ends the input upon encountering newline or EOF. However, to avoid buffer overflow errors and to avoid security risks, its safer to use fgets().