Skip to content

Commit 6e184f2

Browse files
committed
C++: Rename variables 'a' and 'b'.
1 parent da38c90 commit 6e184f2

File tree

1 file changed

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

1 file changed

+25
-13
lines changed

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

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,24 @@ class XercesDOMParserClass extends Class {
6363
* - A is 1 if `setDisableDefaultEntityResolution` is `true`, 0 otherwise.
6464
* - B is 1 if `setCreateEntityReferenceNodes` is `true`, 0 otherwise.
6565
*/
66-
predicate encodeXercesDOMFlowState(string flowstate, int a, int b) {
67-
flowstate = "XercesDOM-0-0" and a = 0 and b = 0
66+
predicate encodeXercesDOMFlowState(
67+
string flowstate, int disabledDefaultEntityResolution, int createEntityReferenceNodes
68+
) {
69+
flowstate = "XercesDOM-0-0" and
70+
disabledDefaultEntityResolution = 0 and
71+
createEntityReferenceNodes = 0
6872
or
69-
flowstate = "XercesDOM-0-1" and a = 0 and b = 1
73+
flowstate = "XercesDOM-0-1" and
74+
disabledDefaultEntityResolution = 0 and
75+
createEntityReferenceNodes = 1
7076
or
71-
flowstate = "XercesDOM-1-0" and a = 1 and b = 0
77+
flowstate = "XercesDOM-1-0" and
78+
disabledDefaultEntityResolution = 1 and
79+
createEntityReferenceNodes = 0
7280
or
73-
flowstate = "XercesDOM-1-1" and a = 1 and b = 1
81+
flowstate = "XercesDOM-1-1" and
82+
disabledDefaultEntityResolution = 1 and
83+
createEntityReferenceNodes = 1
7484
}
7585

7686
/**
@@ -99,14 +109,15 @@ class DisableDefaultEntityResolutionTranformer extends XXEFlowStateTranformer {
99109
}
100110

101111
final override XXEFlowState transform(XXEFlowState flowstate) {
102-
exists(int a, int b |
103-
encodeXercesDOMFlowState(flowstate, a, b) and
112+
exists(int disabledDefaultEntityResolution, int createEntityReferenceNodes |
113+
encodeXercesDOMFlowState(flowstate, disabledDefaultEntityResolution,
114+
createEntityReferenceNodes) and
104115
(
105116
newValue.getValue().toInt() = 1 and // true
106-
encodeXercesDOMFlowState(result, 1, b)
117+
encodeXercesDOMFlowState(result, 1, createEntityReferenceNodes)
107118
or
108119
not newValue.getValue().toInt() = 1 and // false or unknown
109-
encodeXercesDOMFlowState(result, 0, b)
120+
encodeXercesDOMFlowState(result, 0, createEntityReferenceNodes)
110121
)
111122
)
112123
}
@@ -131,14 +142,15 @@ class CreateEntityReferenceNodesTranformer extends XXEFlowStateTranformer {
131142
}
132143

133144
final override XXEFlowState transform(XXEFlowState flowstate) {
134-
exists(int a, int b |
135-
encodeXercesDOMFlowState(flowstate, a, b) and
145+
exists(int disabledDefaultEntityResolution, int createEntityReferenceNodes |
146+
encodeXercesDOMFlowState(flowstate, disabledDefaultEntityResolution,
147+
createEntityReferenceNodes) and
136148
(
137149
newValue.getValue().toInt() = 1 and // true
138-
encodeXercesDOMFlowState(result, a, 1)
150+
encodeXercesDOMFlowState(result, disabledDefaultEntityResolution, 1)
139151
or
140152
not newValue.getValue().toInt() = 1 and // false or unknown
141-
encodeXercesDOMFlowState(result, a, 0)
153+
encodeXercesDOMFlowState(result, disabledDefaultEntityResolution, 0)
142154
)
143155
)
144156
}

0 commit comments

Comments
 (0)