1116
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
Access Control
Integrity
Confidentiality
Availability
Modify Memory
Read Memory
Execute Unauthorized Code or Commands
Gain Privileges or Assume Identity
There is the potential for arbitrary code execution with
privileges of the vulnerable program.
Detection Methods
Fuzzing
Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs
- either randomly or algorithmically - and dynamically invoking the code with those inputs.
Even with random inputs, it is often capable of generating unexpected results such as crashes,
memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases
that clearly indicate bugs, which helps developers to diagnose the issues.
Effectiveness = High
Automated Static Analysis
Automated static analysis, commonly referred to as Static Application Security Testing (SAST),
can find some instances of this weakness by analyzing source code (or binary/compiled code)
without having to execute it. Typically, this is done by building a model of data flow and control
flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input)
with "sinks" (destinations where the data interacts with external components, a lower layer such
as the OS, etc.)
Effectiveness = High
Potential Mitigations
Phase: Implementation
Save an index variable. This is the recommended solution. Rather than subtract pointers from
one another, use an index variable of the same size as the pointers in question. Use this variable
to "walk" from one pointer to the other and calculate the difference. Always validate this number.
Demonstrative Examples
Example 1:
CWE Version 4.14
CWE-469: Use of Pointer Subtraction to Determine Size
CWE-469: Use of Pointer Subtraction to Determine Size