96 If the source buffer is greater than the destination buffer, an overflow will occur.
Also, ensure that the destination buffer is null terminated to prevent future functions
that utilize the destination buffer from having any problems.
97
98
Example insecure implementation snippet:
99 char dest[20];
100 gets(dest);
101
102
Example secure implementation snippet:
103 char dest[20] = {0};
104 fgets(dest, sizeof(dest)-1, stdin);
105
106
Function name: fgets
107 Class: Buffer Overflow
108 Prototype: char *fgets(char *s, int size, FILE *stream);
109 Include: #include <stdio.h>
110 Description:
111 If the source buffer is greater than the destination buffer, an overflow will occur.
Also, ensure that the destination buffer is null terminated to prevent future functions ...