NULL Pointer Dereference
CWE-476
Overtime trend (NVD)
CVSS severity (NVD, All Time)
Per technology (GHSA, All time)
- 88%-Pip
- 5%-Go
- 3%-Rust
- 2%-Others
Short description
Extended description
Best practices to prevent this CWE
Phase: Implementation
If all pointers that could have been modified are sanity-checked previous to use, nearly all NULL pointer dereferences can be prevented.
Phase: Requirements
The choice could be made to use a language that is not susceptible to these issues.
Phase: Implementation
Check the results of all functions that return a value and verify that the value is non-null before acting upon it.
Effectiveness: Moderate
Phase: Architecture and Design
Identify all variables and data stores that receive information from external sources, and apply input validation to make sure that they are only initialized to expected values.
Phase: Implementation
Explicitly initialize all your variables and other data stores, either during declaration or just before the first usage.
Phase: Testing
Use automated static analysis tools that target this type of weakness. Many modern techniques use data flow analysis to minimize the number of false positives. This is not a perfect solution, since 100% accuracy and coverage are not feasible.