CWE-481: Assigning instead of Comparing

ID CWE-481
Abstraction Variant
Structure Simple
Status Draft
The code uses an operator for assignment when the intention was to perform a comparison.

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.

Modes of Introduction

Phase Note
Implementation

Applicable Platforms

Type Class Name Prevalence
Language C
Language C++
Language Java
Language C#

Relationships

View Weakness
# ID View Status # ID Name Abstraction Structure Status
CWE-1000 Research Concepts Draft CWE-480 Use of Incorrect Operator Base Simple Draft
CWE-1000 Research Concepts Draft CWE-697 Incorrect Comparison Pillar Simple Incomplete
Loading...
Loading...