Skip to content

Commit 976ccda

Browse files
authored
Update DeclarationOfVariableWithUnnecessarilyWideScope.ql
1 parent b277082 commit 976ccda

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cpp/ql/src/experimental/Security/CWE/CWE-1126/DeclarationOfVariableWithUnnecessarilyWideScope.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @name Errors When Using Variable Declaration Inside Loop
33
* @description Using variables with the same name is dangerous.
4-
* However, such a situation inside the while loop can lead to a violation of the accessibility of the program.
4+
* However, such a situation inside the while loop can create an infinite loop exhausting resources.
55
* Requires the attention of developers.
66
* @kind problem
77
* @id cpp/errors-when-using-variable-declaration-inside-loop
@@ -37,7 +37,7 @@ class DangerousWhileLoop extends WhileStmt {
3737
/** Holds when there are changes to the variables involved in the condition. */
3838
predicate isUseThisVariable() {
3939
exists(Variable v |
40-
this.getCondition().getAChild*().(VariableAccess).getTarget() = v and
40+
exp.(VariableAccess).getTarget() = v and
4141
(
4242
exists(Assignment aexp |
4343
aexp = this.getStmt().getAChild*() and

0 commit comments

Comments
 (0)