Can't find the vulnerability in this C program
Solution 1:
email
is declared with char email[USR_LEN];
and USR_LEN
is 16, but it is read with fscanf(stdin, "%31s", email);
.
Also, the results of fscanf
are not tested. The user can use Control-D (on Unix) to cause no input, leaving the buffers uninitialized, and then strcmp
can overrun a buffer.