File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
cpp/ql/src/Security/CWE/CWE-497 Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -33,14 +33,7 @@ abstract class SystemData extends Element {
3333 result = getAnExpr ( ) or
3434
3535 // flow via global or member variable (conservative approximation)
36- exists ( Variable var |
37- (
38- var .getAnAssignedValue ( ) = getAnExprIndirect ( ) or
39- var .getAnAccess ( ) = getAnExprIndirect ( )
40- ) and
41- result = var .getAnAccess ( ) and
42- not var instanceof LocalScopeVariable
43- ) or
36+ result = getAnAffectedVar ( ) .getAnAccess ( ) or
4437
4538 // flow via stack variable
4639 definitionUsePair ( _, getAnExprIndirect ( ) , result ) or
@@ -50,6 +43,17 @@ abstract class SystemData extends Element {
5043 // flow from assigned value to assignment expression
5144 result .( AssignExpr ) .getRValue ( ) = getAnExprIndirect ( )
5245 }
46+
47+ /** Gets a global or member variable that may be affected by this system
48+ * data (conservative approximation).
49+ */
50+ private Variable getAnAffectedVar ( ) {
51+ (
52+ result .getAnAssignedValue ( ) = this .getAnExprIndirect ( ) or
53+ result .getAnAccess ( ) = this .getAnExprIndirect ( )
54+ ) and
55+ not result instanceof LocalScopeVariable
56+ }
5357}
5458
5559/**
You can’t perform that action at this time.
0 commit comments