CWE-1126: Declaration of Variable with Unnecessarily Wide Scope
The source code declares a variable in one scope, but the variable is only used within a narrower scope.
Overview
CWE-1126 (Declaration of Variable with Unnecessarily Wide Scope) is a base-level software weakness catalogued by MITRE in the Common Weakness Enumeration (CWE). It describes a recurring type of mistake that can lead to exploitable security vulnerabilities.