CWE-1164: Irrelevant Code

Export to Word

Description

The product contains code that is not essential for execution, i.e. makes no state changes and has no side effects that alter data or control flow, such that removal of the code would have no impact to functionality or correctness.

Extended Description

Irrelevant code could include dead code, initialization that is not used, empty blocks, code that could be entirely removed due to optimization, etc.


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
None listed.

Common Consequences

Potential Mitigations

Applicable Platforms


Demonstrative Examples

Intro: The condition for the second if statement is impossible to satisfy. It requires that the variables be non-null. However, on the only path where s can be assigned a non-null value, there is a return statement.

String s = null; if (b) { s = "Yes"; return; } if (s != null) { Dead(); }

Intro: The following code excerpt assigns to the variable r and then overwrites the value without using it.

r = getName(); r = getNewBuffer(buf);

Notes

← Back to CWE list