CWE-703: Improper Check or Handling of Exceptional Conditions

Export to Word

Description

The product does not properly anticipate or handle exceptional conditions that rarely occur during normal operation of the product.

Extended Description

N/A


ThreatScore

Threat Mapped score: 0.0

Industry: Finiancial

Threat priority: Unclassified


Observed Examples (CVEs)

Related Attack Patterns (CAPEC)

N/A


Attack TTPs

N/A

Modes of Introduction

Phase Note
Architecture and Design N/A
Implementation REALIZATION: This weakness is caused during implementation of an architectural security tactic.
Operation N/A

Common Consequences

Potential Mitigations

Applicable Platforms


Demonstrative Examples

Intro: Consider the following code segment:

Body: The programmer expects that when fgets() returns, buf will contain a null-terminated string of length 9 or less. But if an I/O error occurs, fgets() will not null-terminate buf. Furthermore, if the end of the file is reached before any characters are read, fgets() returns without writing anything to buf. In both of these situations, fgets() signals that something unusual has happened by returning NULL, but in this code, the warning will not be noticed. The lack of a null terminator in buf can result in a buffer overflow in the subsequent call to strcpy().

char buf[10], cp_buf[10]; fgets(buf, 10, stdin); strcpy(cp_buf, buf);

Intro: The following method throws three types of exceptions.

Body: While it might seem tidier to write

public void doExchange() throws IOException, InvocationTargetException, SQLException { ... }

Notes

← Back to CWE list