CWE Database
/

CWE-482

Back to CWE list

CWE-482

Comparing instead of Assigning

Variant
Draft

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.

Parent Weaknesses (ChildOf)

Common Consequences

Scope

Availability
Integrity

Impact

Unexpected State

Potential Mitigations

Testing

Many IDEs and static analysis products will detect this problem.

Applicable Platforms

C
C++

Security Training

Train your team to recognize and prevent security threats with our comprehensive security awareness program.

Start Training

Vulnerability Scanning

Discover vulnerabilities in your applications and infrastructure before attackers do.

Scan Now