Tag Archives: Comparing instead of Assigning

CWE-482 – Comparing instead of Assigning

Read Time:26 Second

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.

Modes of Introduction:

– Implementation

 

Likelihood of Exploit: Low

 

Related Weaknesses

CWE-480

 

Consequences

Availability, Integrity: Unexpected State

The assignment will not take place, which should cause obvious program execution problems.

 

Potential Mitigations

Phase: Testing

Description: 

Many IDEs and static analysis products will detect this problem.

CVE References