Wild Pointer / Uninitialized Pointer

Detects uninitialized or dangling pointer usage that can lead to arbitrary memory access.

zakirkun 15029a1 2 files · 2.0 KB Updated

File contents

Wild / Uninitialized Pointer

Overview

Wild pointers are pointers that have not been initialized to a valid address. Dereferencing them reads from or writes to arbitrary memory, leading to:

  • Crashes (SIGSEGV)
  • Data corruption
  • Security vulnerabilities (if attacker controls the uninitialized memory)

Common causes:

  • Pointer declared but not initialized: int *p; then *p = 1;
  • Pointer used after free() without zeroing
  • Conditional initialization where some paths skip initialization

Remediation

  • Initialize all pointers to NULL at declaration
  • Use address sanitizers to detect wild pointer access
  • Use C++ smart pointers instead of raw pointers

zakirkun/ice-tea/tree/main/skills/memory/wild-pointer commit 15029a17d9

Frequently asked questions

npx skillmds@latest add zakirkun/wild-pointer-uninitialized-pointer