Skip to content

Commit c4bc705

Browse files
committed
C++: Additional test cases.
1 parent ca2959c commit c4bc705

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ class XMLUni
2121
{
2222
public:
2323
static const XMLCh fgXercesDisableDefaultEntityResolution[];
24+
static const XMLCh fgXercesHarmlessOption[];
2425
};
2526

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,28 @@ void test3_5(InputSource &data) {
5555
test3_5_init();
5656
p_3_5->parse(data); // GOOD
5757
}
58+
59+
void test3_6(InputSource &data) {
60+
SAX2XMLReader *p = XMLReaderFactory::createXMLReader();
61+
62+
p->setFeature(XMLUni::fgXercesDisableDefaultEntityResolution, false);
63+
p->parse(data); // BAD (parser not correctly configured) [NOT DETECTED]
64+
}
65+
66+
void test3_7(InputSource &data) {
67+
SAX2XMLReader *p = XMLReaderFactory::createXMLReader();
68+
69+
p->setFeature(XMLUni::fgXercesHarmlessOption, true);
70+
p->parse(data); // BAD (parser not correctly configured) [NOT DETECTED]
71+
}
72+
73+
void test3_8(InputSource &data) {
74+
SAX2XMLReader *p = XMLReaderFactory::createXMLReader();
75+
const XMLCh *feature = XMLUni::fgXercesDisableDefaultEntityResolution;
76+
77+
p->setFeature(feature, true);
78+
p->parse(data); // GOOD
79+
}
80+
81+
82+

0 commit comments

Comments
 (0)