Skip to content

Commit 33d499c

Browse files
committed
C++: Address review comments.
1 parent 79d1ffc commit 33d499c

File tree

1 file changed

+5
-5
lines changed
  • cpp/ql/src/Security/CWE/CWE-611

1 file changed

+5
-5
lines changed

cpp/ql/src/Security/CWE/CWE-611/XXE.ql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class XercesDOMParserClass extends Class {
5959
/**
6060
* The `SAXParser` class.
6161
*/
62-
class SAXParser extends Class {
63-
SAXParser() { this.hasName("SAXParser") }
62+
class SAXParserClass extends Class {
63+
SAXParserClass() { this.hasName("SAXParser") }
6464
}
6565

6666
/**
@@ -112,7 +112,7 @@ class DisableDefaultEntityResolutionTranformer extends XXEFlowStateTranformer {
112112
call.getTarget() = f and
113113
(
114114
f.getDeclaringType() instanceof AbstractDOMParserClass or
115-
f.getDeclaringType() instanceof SAXParser
115+
f.getDeclaringType() instanceof SAXParserClass
116116
) and
117117
f.hasName("setDisableDefaultEntityResolution") and
118118
this = call.getQualifier() and
@@ -172,7 +172,7 @@ class CreateEntityReferenceNodesTranformer extends XXEFlowStateTranformer {
172172
class ParseFunction extends Function {
173173
ParseFunction() {
174174
this.getClassAndName("parse") instanceof AbstractDOMParserClass or
175-
this.getClassAndName("parse") instanceof SAXParser
175+
this.getClassAndName("parse") instanceof SAXParserClass
176176
}
177177
}
178178

@@ -213,9 +213,9 @@ class XXEConfiguration extends DataFlow::Configuration {
213213
// source is the write on `this` of a call to the `SAXParser`
214214
// constructor.
215215
exists(CallInstruction call |
216+
call.getStaticCallTarget() = any(SAXParserClass c).getAConstructor() and
216217
node.asInstruction().(WriteSideEffectInstruction).getDestinationAddress() =
217218
call.getThisArgument() and
218-
call.getStaticCallTarget().(Constructor).getDeclaringType() instanceof SAXParser and
219219
encodeXercesFlowState(flowstate, 0, 1) // default configuration
220220
)
221221
}

0 commit comments

Comments
 (0)