1114
CWE-468: Incorrect Pointer Scaling
Weakness ID : 468
Structure : Simple
Abstraction : Base
Description
In C and C++, one may often accidentally refer to the wrong memory due to the semantics of when
math operations are implicitly scaled.
Relationships
The table(s) below shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOr and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition, relationships such
as PeerOf and CanAlsoBe are defined to show similar weaknesses that may want to be explored.
Relevant to the view "Research Concepts" (CWE-1000)
Nature Type ID Name Page
ChildOf 682 Incorrect Calculation 1499
Relevant to the view "Software Development" (CWE-699)
Nature Type ID Name Page
MemberOf 465 Pointer Issues 2328
Applicable Platforms
Language : C (Prevalence = Undetermined)
Language : C++ (Prevalence = Undetermined)
Likelihood Of Exploit
Medium
Common Consequences
Scope Impact Likelihood
Confidentiality
Integrity
Read Memory
Modify Memory
Incorrect pointer scaling will often result in buffer overflow
conditions. Confidentiality can be compromised if the
weakness is in the context of a buffer over-read or underread.
Potential Mitigations
Phase: Architecture and Design
Use a platform with high-level memory abstractions.
Phase: Implementation
Always use array indexing instead of direct pointer manipulation.
Phase: Architecture and Design
Use technologies for preventing buffer overflows.
Demonstrative Examples
Example 1:
This example attempts to calculate the position of the second byte of a pointer.
CWE Version 4.14
CWE-469: Use of Pointer Subtraction to Determine Size
CWE-469: Use of Pointer Subtraction to Determine Size