CWE-563: Assignment to Variable without Use

Description

The variable's value is assigned but never used, making it a dead store.

Submission Date :

July 19, 2006, midnight

Modification Date :

2023-06-29 00:00:00+00:00

Organization :

MITRE
Extended Description

After the assignment, the variable is either assigned another value or goes out of scope. It is likely that the variable is simply vestigial, but it is also possible that the unused variable points out a bug.

Example Vulnerable Codes

Example - 1

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


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

Related Weaknesses

This table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined to give an overview of the different insight to similar items that may exist at higher and lower levels of abstraction.

Visit http://cwe.mitre.org/ for more details.