CWE-481

Assigning instead of Comparing

Medium

Description

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

Potential Impact

How to Fix

Testing

Many IDEs and static analysis products will detect this problem.

Implementation

Place constants on the left. If one attempts to assign a constant with a variable, the compiler will produce an error.

Detection Methods

Related Weaknesses

References

View on MITRE CWE Database →

Need Help Fixing This Vulnerability?

Our security experts can help you identify and remediate CWE-481 vulnerabilities in your codebase.

Get Security Assessment