Skip to content

Commit dd25878

Browse files
committed
C++: More test cases.
1 parent 1d71f04 commit dd25878

File tree

1 file changed

+26
-3
lines changed
  • cpp/ql/test/query-tests/Security/CWE/CWE-611

1 file changed

+26
-3
lines changed

cpp/ql/test/query-tests/Security/CWE/CWE-611/tests5.cpp

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,42 @@ void test5_2(DOMImplementationLS *impl, InputSource &data) {
3636
p->parse(data); // GOOD
3737
}
3838

39+
void test5_3(DOMImplementationLS *impl, InputSource &data) {
40+
DOMLSParser *p = impl->createLSParser();
41+
42+
p->getDomConfig()->setParameter(XMLUni::fgXercesDisableDefaultEntityResolution, false);
43+
p->parse(data); // BAD (parser not correctly configured) [NOT DETECTED]
44+
}
45+
46+
void test5_4(DOMImplementationLS *impl, InputSource &data) {
47+
DOMLSParser *p = impl->createLSParser();
48+
DOMConfiguration *cfg = p->getDomConfig();
49+
50+
cfg->setParameter(XMLUni::fgXercesDisableDefaultEntityResolution, true);
51+
p->parse(data); // GOOD
52+
}
53+
54+
void test5_5(DOMImplementationLS *impl, InputSource &data) {
55+
DOMLSParser *p = impl->createLSParser();
56+
DOMConfiguration *cfg = p->getDomConfig();
57+
58+
cfg->setParameter(XMLUni::fgXercesDisableDefaultEntityResolution, false);
59+
p->parse(data); // BAD (parser not correctly configured) [NOT DETECTED]
60+
}
61+
3962
DOMImplementationLS *g_impl;
4063
DOMLSParser *g_p1, *g_p2;
4164
InputSource *g_data;
4265

43-
void test5_3_init() {
66+
void test5_6_init() {
4467
g_p1 = g_impl->createLSParser();
4568
g_p1->getDomConfig()->setParameter(XMLUni::fgXercesDisableDefaultEntityResolution, true);
4669

4770
g_p2 = g_impl->createLSParser();
4871
}
4972

50-
void test5_3() {
51-
test5_3_init();
73+
void test5_6() {
74+
test5_6_init();
5275

5376
g_p1->parse(*g_data); // GOOD
5477
g_p2->parse(*g_data); // BAD (parser not correctly configured) [NOT DETECTED]

0 commit comments

Comments
 (0)