File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
cpp/ql/test/query-tests/Security/CWE/CWE-611 Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -21,5 +21,6 @@ class XMLUni
2121{
2222public:
2323 static const XMLCh fgXercesDisableDefaultEntityResolution[];
24+ static const XMLCh fgXercesHarmlessOption[];
2425};
2526
Original file line number Diff line number Diff 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+
You can’t perform that action at this time.
0 commit comments