BaseDraft

CWE-563Assignment to Variable without Use

Category: other

Description

The variable's value is assigned but never used, making it a dead store. 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.

Common consequences· 1

  • Other — Quality Degradation, Varies by Context
    This weakness could be an indication of a bug in the program or a deprecated variable that was not removed and is an indication of poor quality. This could lead to further bugs and the introduction of weaknesses.

Potential mitigations· 1

  • [Implementation]Remove unused variables from the code.

References

  1. https://cwe.mitre.org/data/definitions/563.html

Related by meaning· 6

Nearest entities by semantic similarity across the cs-graph corpus.

CWE
Declaration of Variable with Unnecessarily Wide Scope
CWE
Comparing instead of Assigning
CWE
Dead Code
CWE
Use of Same Variable for Multiple Purposes
CWE
Use of Uninitialized Variable
CWE
Assigning instead of Comparing
Sourced from MITRE CWE 4.20. Curated for EU compliance use cases by Adam Lundqvist, Founder at SQUR.