rpc: guard against json parsing a non object

This commit is contained in:
moneromooo-monero 2017-12-10 15:36:15 +00:00
parent c2ed8618e4
commit b4524892fb
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

View File

@ -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();
} }