VariantIncomplete

CWE-761Free of Pointer not at Start of Buffer

Category: memory

Description

The product calls free() on a pointer to a memory resource that was allocated on the heap, but the pointer is not at the start of the buffer.

Common consequences· 1

  • Integrity / Availability / Confidentiality — Modify Memory, DoS: Crash, Exit, or Restart, Execute Unauthorized Code or Commands

Potential mitigations· 4

  • [Implementation]When utilizing pointer arithmetic to traverse a buffer, use a separate variable to track progress through memory and preserve the originally allocated address for later freeing.
  • [Implementation]When programming in C++, consider using smart pointers provided by the boost library to help correctly and consistently manage memory.
  • [Architecture and Design]
  • [Architecture and Design]Use a language that provides abstractions for memory allocation and deallocation.

References

  1. https://cwe.mitre.org/data/definitions/761.html

Related by meaning· 6

Nearest entities by semantic similarity across the cs-graph corpus.

CWE
Free of Memory not on the Heap
CWE
Double Free
CWE
Access of Memory Location Before Start of Buffer
CWE
NULL Pointer Dereference
CWE
Access of Memory Location After End of Buffer
CWE
Access of Uninitialized Pointer
Sourced from MITRE CWE 4.20. Curated for EU compliance use cases by Adam Lundqvist, Founder at SQUR.