plugin: add check on the type json object during the IO message handling

This commit is contained in:
Vincenzo Palazzo 2022-06-25 23:44:02 +00:00 committed by neil saitug
parent d284b98911
commit b624c53051

View file

@ -643,6 +643,11 @@ static const char *plugin_read_json_one(struct plugin *plugin,
return NULL;
}
if (plugin->toks->type != JSMN_OBJECT)
return tal_fmt(
plugin,
"JSON-RPC message is not a valid JSON object type");
jrtok = json_get_member(plugin->buffer, plugin->toks, "jsonrpc");
idtok = json_get_member(plugin->buffer, plugin->toks, "id");