Added a nesting limit to the parser to prevent stack overflow that could be a security issue

This commit is contained in:
Benoit Blanchon committed 2014-11-06 10:24:37 +01:00
1 parent 2e4dd2d591
commit a3425a6306
5 files changed
+104 -7

No files matched your search

+5
View File
@@ -39,6 +39,9 @@ bool JsonParser::skip(const char *wordToSkip) {
}
void JsonParser::parseAnythingTo(JsonVariant &destination) {
if (_nestingLimit == 0) return;
_nestingLimit--;
skipSpaces();
switch (*_ptr) {
@@ -79,6 +82,8 @@ void JsonParser::parseAnythingTo(JsonVariant &destination) {
destination = parseString();
break;
}
_nestingLimit++;
}
JsonArray &JsonParser::parseArray() {