CWE-481: Assigning instead of Comparing

VariantDraftExploit Likelihood: Low

The code uses an operator for assignment when the intention was to perform a comparison.

View on MITRE
Back to CWE Lookup

Extended Description

In many languages the compare statement is very close in appearance to the assignment statement and are often confused. This bug is generally the result of a typo and usually causes obvious problems with program execution. If the comparison is in an if statement, the if statement will usually evaluate the value of the right-hand side of the predicate.

Technical Details

Structure
Simple

Applicable To

Languages
CC++JavaC#
Platforms

Learn More