CWE
Home > CWE List > CWE- Individual Dictionary Definition (1.1)  
Search by ID:

CWE-563: Unused Variable

Individual Definition in a New Window
Unused Variable
Status: Draft
Weakness ID: 563 (Weakness Variant)
Description
Summary

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

Extended Description

It is likely that the variable is simply vestigial, but it is also possible that the unused variable points out a bug.

Potential Mitigations

Remove unused variables from the code.

Demonstrative Examples

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

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

This variable's value is not used. After the assignment, the variable is either assigned another value or goes out of scope.

Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfWeakness ClassWeakness ClassWeakness Class398Indicator of Poor Code Quality
Development Concepts (primary)699
Research Concepts (primary)1000
ChildOfCategoryCategory747CERT C Secure Coding Section 49 - Miscellaneous (MSC)
Weaknesses Addressed by the CERT C Secure Coding Standard (primary)734
Taxonomy Mappings
Mapped Taxonomy NameNode IDMapped Node Name
Anonymous Tool Vendor (under NDA)  
CERT C Secure CodingMSC00-CCompile cleanly at high warning levels
Time of Introduction
* Implementation
Content History
Submissions
Anonymous Tool Vendor (under NDA). (Externally Mined)
Modifications
Eric Dalci. Cigital. 2008-07-01. (External)
updated Potential_Mitigations, Time_of_Introduction
CWE Content Team. MITRE. 2008-09-08. (Internal)
updated Description, Relationships, Other_Notes, Taxonomy_Mappings
CWE Content Team. MITRE. 2008-11-24. (Internal)
updated Relationships, Taxonomy_Mappings
Page Last Updated: November 24, 2008