Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CWE-563 (未使用的变量) — Vulnerability Class 2

2 vulnerabilities classified as CWE-563 (未使用的变量). AI Chinese analysis included.

CWE-563, Assignment to Variable without Use, is a code quality weakness where a variable receives a value that is never subsequently utilized, creating a dead store. This flaw typically arises from vestigial code or logical errors where a developer assigns a value but fails to reference it before the variable is reassigned or goes out of scope. While often harmless, it can obscure critical bugs or indicate incomplete implementation. Exploitation is rare, as this weakness rarely leads to direct security breaches, but it degrades code maintainability and readability. Developers avoid this issue by employing static analysis tools that detect unused assignments, conducting rigorous code reviews to identify logical inconsistencies, and adhering to coding standards that enforce the removal of dead code. Regular refactoring helps ensure that every variable assignment serves a functional purpose, thereby enhancing overall software integrity and reducing technical debt.

MITRE CWE 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)
OtherQuality 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.
Mitigations (1)
ImplementationRemove unused variables from the code.
Examples (1)
The following code excerpt assigns to the variable r and then overwrites the value without using it.
r = getName(); r = getNewBuffer(buf);
Bad · C

Vulnerabilities classified as CWE-563 (未使用的变量) represent 2 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.