Skip to content

Commit 6790028

Browse files
committed
C#: Use guards library
1 parent 41b4d70 commit 6790028

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

csharp/ql/src/Security Features/CWE-020/RuntimeChecksBypass.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
*/
1414

1515
import semmle.code.csharp.serialization.Serialization
16+
import semmle.code.csharp.controlflow.Guards
1617

1718
/**
1819
* The result is a write to the field `f`, assigning it the value
1920
* of variable `v` which was checked by the condition `check`.
2021
*/
21-
Expr checkedWrite(Field f, Variable v, IfStmt check) {
22+
GuardedExpr checkedWrite(Field f, Variable v, IfStmt check) {
2223
result = v.getAnAccess() and
2324
result = f.getAnAssignedValue() and
24-
check.getCondition() = v.getAnAccess().getParent*() and
25-
result.getAControlFlowNode() = check.getAControlFlowNode().getASuccessor*()
25+
check.getCondition().getAChildExpr*() = result.getAGuard(_, _)
2626
}
2727

2828
/**

0 commit comments

Comments
 (0)