1966
CWE-1126: Declaration of Variable with Unnecessarily Wide Scope
Weakness ID : 1126
Structure : Simple
Abstraction : Base
Description
The source code declares a variable in one scope, but the variable is only used within a narrower
scope.
Extended Description
This issue makes it more difficult to understand and/or maintain the product, which indirectly affects
security by making it more difficult or time-consuming to find and/or fix vulnerabilities. It also might
make it easier to introduce vulnerabilities.
Relationships
The table(s) below shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOr and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition, relationships such
as PeerOf and CanAlsoBe are defined to show similar weaknesses that may want to be explored.
Relevant to the view "Research Concepts" (CWE-1000)
Nature Type ID Name Page
ChildOf 710 Improper Adherence to Coding Standards 1549
Relevant to the view "Software Development" (CWE-699)
Nature Type ID Name Page
MemberOf 1006 Bad Coding Practices 2422
Weakness Ordinalities
Indirect :
Common Consequences
Scope Impact Likelihood
Other Reduce Maintainability
MemberOf Relationships
This MemberOf relationships table shows additional CWE Catgeories and Views that reference this
weakness as a member. This information is often useful in understanding where a weakness fits
within the context of external information sources.
Nature Type ID Name Page
MemberOf 1412 Comprehensive Categorization: Poor Coding Practices 1400 2538
CWE-1127: Compilation with Insufficient Warnings or Errors
Weakness ID : 1127
Structure : Simple
Abstraction : Base
Description
The code is compiled without sufficient warnings enabled, which may prevent the detection of
subtle bugs or quality issues.
Extended Description
CWE Version 4.14
CWE-1164: Irrelevant Code
CWE-1164: Irrelevant Code