Common typo patterns that change application logic
ID |
c.miscellaneous.typos |
Severity |
low |
Remediation Complexity |
medium |
Remediation Risk |
medium |
Remediation Effort |
medium |
Resource |
Miscellaneous |
Language |
C / C++ |
Description
The programmer accidentally uses the wrong operator, which changes the application logic in security-relevant ways. This rule also covers some other common typo patterns.
Rationale
The programmer accidentally uses the wrong operator, which changes the application logic in security-relevant ways. This rule also covers some other common typo patterns.
The following code illustrates a vulnerable pattern detected by this rule:
void bad1()
{
char *src, *dst;
int left;
while (*src && left)
{
*dst++ = *src++;
// VULNERABLE: Common typo patterns that change application logic
if (left = 0)
{
die("badlen");
}
left--;
}
}