CWE-680: Integer Overflow to Buffer Overflow

Export to Word

Description

The product performs a calculation to determine how much memory to allocate, but an integer overflow can occur that causes less memory to be allocated than expected, leading to a buffer overflow.

Extended Description

N/A


ThreatScore

Threat Mapped score: 1.5

Industry: Finiancial

Threat priority: P4 - Informational (Low)


Observed Examples (CVEs)

Related Attack Patterns (CAPEC)


Attack TTPs

N/A

Modes of Introduction

Phase Note
None listed.

Common Consequences

Potential Mitigations

Applicable Platforms


Demonstrative Examples

Intro: The following image processing code allocates a table for images.

Body: This code intends to allocate a table of size num_imgs, however as num_imgs grows large, the calculation determining the size of the list will eventually overflow (CWE-190). This will result in a very small list to be allocated instead. If the subsequent code operates on the list as if it were num_imgs long, it may result in many types of out-of-bounds problems (CWE-119).

img_t table_ptr; /*struct containing img data, 10kB each*/ int num_imgs; ... num_imgs = get_num_imgs(); table_ptr = (img_t*)malloc(sizeof(img_t)*num_imgs); ...

Notes

← Back to CWE list