CWE-130

Improper Handling of Length Parameter Inconsistency

Medium

Description

The product parses a formatted message or structure, but it does not handle or incorrectly handles a length field that is inconsistent with the actual length of the associated data.

Potential Impact

How to Fix

Implementation

When processing structured incoming data containing a size field followed by raw data, ensure that you identify and resolve any inconsistencies between the size field and the actual size of the data.

Implementation

Do not let the user control the size of the buffer.

Implementation

Validate that the length of the user-supplied data is consistent with the buffer size.

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

Get Security Assessment