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
NULLat declaration - Use address sanitizers to detect wild pointer access
- Use C++ smart pointers instead of raw pointers