Use of insecure scanf-family functions prone to buffer overflow
ID |
c.buffer_overflow.insecure_api_scanf_etc |
Severity |
critical |
Resource |
Buffer Overflow |
Language |
C / C++ |
Description
A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer.
Rationale
A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer.
The following code illustrates a vulnerable pattern detected by this rule:
int number;
char fmt[] = "whatever";
// VULNERABLE: Use of insecure scanf-family functions prone to buffer overflow
scanf("%s", buf);