Esc
Null Pointer Checking
Definition
Checking if a pointer is NULL.
Synonyms: Nil Pointer Checking.How it Works
Programmatically checking if a pointer is NULL before use.
Considerations
- Pointers should be checked prior to use after they have, or may have been modified.
- Note that it may vary by circumstance whether the caller, or callee is responsible for checking if a pointer is NULL.
- Note: This resource should not be considered a definitive or exhaustive coding guideline.
Artifact Relationships:
This defensive technique is related to specific artifacts. Click the artifact node for more information.
References
All
Guideline
External Knowledge Base
The following references were used to develop the Null Pointer Checking knowledge-base article.
(Note: the consideration of references does not imply specific functionality exists in an offering.)
SEI CERT C Coding Standard
Reference Type: Guideline Organization: Software Engineering Institute
CWE-476: NULL Pointer Dereference
Reference Type: External Knowledge Base Organization: MITRE
SEI CERT C Coding Standard
Reference Type: Guideline Organization: Software Engineering Institute