CWE-482
Comparing instead of Assigning
AI Translation Available
The code uses an operator for comparison when the intention was to perform an assignment.
Status
draft
Abstraction
variant
Likelihood
low
Affected Platforms
C
C++
Extended Description
AI Translation
In many languages, the compare statement is very close in appearance to the assignment statement; they are often confused.
Technical Details
AI Translation
Common Consequences
availability
integrity
Impacts
unexpected state
Detection Methods
automated static analysis
Potential Mitigations
Phases:
testing
Descriptions:
•
Many IDEs and static analysis products will detect this problem.