D3-NPC

Harden
Null Pointer Checking

Definition

Checking if a pointer is NULL.

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 relates to specific digital artifacts.

hardens
hardens
Null Pointer Checking
Memory Free Function
Pointer Dereferencing Function

References

Reference - Null Pointer Checking - SEI Reference - Null Pointer Dereferencing - CWE-476 Reference - Pointer Validation Function - SEI