rpc: guard against json parsing a non object

getblocktemplate-height
moneromooo-monero 7 years ago
parent c2ed8618e4
commit b4524892fb
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

@ -111,7 +111,7 @@ FullMessage::FullMessage(Message* message)
FullMessage::FullMessage(const std::string& json_string, bool request) FullMessage::FullMessage(const std::string& json_string, bool request)
{ {
doc.Parse(json_string.c_str()); doc.Parse(json_string.c_str());
if (doc.HasParseError()) if (doc.HasParseError() || !doc.IsObject())
{ {
throw cryptonote::json::PARSE_FAIL(); throw cryptonote::json::PARSE_FAIL();
} }

Loading…
Cancel
Save