CWE-482: Comparing instead of Assigning
Description
The code uses an operator for comparison when the intention was to perform an assignment.
In many languages, the compare statement is very close in appearance to the assignment statement; they are often confused.
- Abstraction
- VariantA weakness tied to a specific language, technology or resource.
- Likelihood of exploit
- Low
- Status
- Draft
Common consequences
- AvailabilityIntegrity
Unexpected State
The assignment will not take place, which should cause obvious program execution problems.
Potential mitigations
- Testing
Many IDEs and static analysis products will detect this problem.
Related weaknesses
Parent weaknesses
CAPEC attack patterns that exploit it
CWE 4.20 links no CAPEC attack pattern to this weakness.