CWE-681

Incorrect Conversion between Numeric Types

High

Description

When converting from one data type to another, such as long to integer, data can be omitted or translated in a way that produces unexpected values. If the resulting values are used in a sensitive context, then dangerous behaviors may occur.

Potential Impact

How to Fix

Implementation

Avoid making conversion between numeric types. Always check for the allowed ranges.

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-681 vulnerabilities in your codebase.

Get Security Assessment