Skip to content

Commit aeb1acb

Browse files
committed
C++: Use the new API in queries.
1 parent 66e8b2d commit aeb1acb

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

cpp/ql/src/Security/CWE/CWE-079/CgiXss.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module Config implements DataFlow::ConfigSig {
3737
predicate isBarrier(DataFlow::Node node) {
3838
isSink(node) and node.asExpr().getUnspecifiedType() instanceof ArithmeticType
3939
or
40-
node.asInstruction().(StoreInstruction).getResultType() instanceof ArithmeticType
40+
node.asCertainDefinition().getUnspecifiedType() instanceof ArithmeticType
4141
}
4242
}
4343

cpp/ql/src/Security/CWE/CWE-114/UncontrolledProcessOperation.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module Config implements DataFlow::ConfigSig {
3737
predicate isBarrier(DataFlow::Node node) {
3838
isSink(node) and node.asExpr().getUnspecifiedType() instanceof ArithmeticType
3939
or
40-
node.asInstruction().(StoreInstruction).getResultType() instanceof ArithmeticType
40+
node.asCertainDefinition().getUnspecifiedType() instanceof ArithmeticType
4141
}
4242
}
4343

cpp/ql/src/Security/CWE/CWE-134/UncontrolledFormatString.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module Config implements DataFlow::ConfigSig {
4242
predicate isBarrier(DataFlow::Node node) {
4343
isSink(node) and isArithmeticNonCharType(node.asExpr().getUnspecifiedType())
4444
or
45-
isArithmeticNonCharType(node.asInstruction().(StoreInstruction).getResultType())
45+
isArithmeticNonCharType(node.asCertainDefinition().getUnspecifiedType())
4646
}
4747
}
4848

cpp/ql/src/Security/CWE/CWE-170/ImproperNullTerminationTainted.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private module Config implements DataFlow::ConfigSig {
3737
predicate isBarrier(DataFlow::Node node) {
3838
isSink(node) and node.asExpr().getUnspecifiedType() instanceof ArithmeticType
3939
or
40-
node.asInstruction().(StoreInstruction).getResultType() instanceof ArithmeticType
40+
node.asCertainDefinition().getUnspecifiedType() instanceof ArithmeticType
4141
or
4242
mayAddNullTerminator(_, node.asIndirectExpr())
4343
}

cpp/ql/src/Security/CWE/CWE-190/ArithmeticTainted.ql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ module Config implements DataFlow::ConfigSig {
7575
predicate isSink(DataFlow::Node sink) { isSink(sink, _, _) }
7676

7777
predicate isBarrier(DataFlow::Node node) {
78-
exists(StoreInstruction store | store = node.asInstruction() |
78+
exists(StoreInstruction store, Expr e |
79+
store = node.asInstruction() and e = node.asCertainDefinition()
80+
|
7981
// Block flow to "likely small expressions"
80-
bounded(store.getSourceValue().getUnconvertedResultExpression())
82+
bounded(e)
8183
or
8284
// Block flow to "small types"
8385
store.getResultType().getUnspecifiedType().(IntegralType).getSize() <= 1

0 commit comments

Comments
 (0)