Unused Variable |
Weakness ID: 563 (Weakness Variant) | Status: Draft |
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.
Example 1
The following code excerpt assigns to the variable r and then overwrites the value without using it.
(Bad Code)
Example Language: C
r = getName();
r = getNewBuffer(buf);
This variable's value is not used. After the assignment, the variable is either assigned another value or goes out of scope. |
Nature | Type | ID | Name | View(s) this relationship pertains to![]() |
---|---|---|---|---|
ChildOf | ![]() | 398 | Indicator of Poor Code Quality | Development Concepts (primary)699 Research Concepts (primary)1000 |
ChildOf | ![]() | 747 | CERT C Secure Coding Section 49 - Miscellaneous (MSC) | Weaknesses Addressed by the CERT C Secure Coding Standard (primary)734 |
Mapped Taxonomy Name | Node ID | Fit | Mapped Node Name |
---|---|---|---|
Anonymous Tool Vendor (under NDA) | |||
CERT C Secure Coding | MSC00-C | Compile cleanly at high warning levels |
Submissions | ||||
---|---|---|---|---|
Submission Date | Submitter | Organization | Source | |
Anonymous Tool Vendor (under NDA) | Externally Mined | |||
Modifications | ||||
Modification Date | Modifier | Organization | Source | |
2008-07-01 | Eric Dalci | Cigital | External | |
updated Potential Mitigations, Time of Introduction | ||||
2008-09-08 | CWE Content Team | MITRE | Internal | |
updated Description, Relationships, Other Notes, Taxonomy Mappings | ||||
2008-11-24 | CWE Content Team | MITRE | Internal | |
updated Relationships, Taxonomy Mappings | ||||
2009-05-27 | CWE Content Team | MITRE | Internal | |
updated Demonstrative Examples |