logo
Home/CWEs/CWE-395/

CWE-395 - Use of NullPointerException Catch to Detect NULL Pointer Dereference

  • Abstraction:Base
  • Structure:Simple
  • Status:Draft
  • Release Date:2006-07-19
  • Latest Modification Date:2024-02-29

Weakness Name

Use of NullPointerException Catch to Detect NULL Pointer Dereference

Description

Catching NullPointerException should not be used as an alternative to programmatic checks to prevent dereferencing a null pointer.

Programmers typically catch NullPointerException under three circumstances: Of these three circumstances, only the last is acceptable.

Common Consequences

Scope: Availability

Impact: DoS: Resource Consumption (CPU)

Related Weaknesses

CWE-705Incorrect Control Flow Scoping

CWE-755Improper Handling of Exceptional ConditionsMedium