This weakness occurs when a single variable is reused to handle multiple, unrelated tasks or to store different pieces of data throughout the code. This practice muddies the variable's purpose and makes the logic harder to follow.
Reusing a variable for multiple purposes creates confusing code that is difficult to read and maintain. When a variable's meaning changes depending on the context, developers must spend extra mental effort to track its current state, increasing the chance of misinterpretation and logic errors. This confusion directly impacts security by making it harder to spot vulnerabilities during code reviews or audits. It slows down the process of fixing defects and makes it easier to introduce new security flaws when modifying the code, as the true intent and data flow are obscured.
Impact: Reduce Maintainability