Skip to content

Commit

Permalink
plugin: add check on the type json object during the IO message handling
Browse files Browse the repository at this point in the history
  • Loading branch information
vincenzopalazzo authored and niftynei committed Jul 14, 2022
1 parent d284b98 commit b624c53
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lightningd/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down

0 comments on commit b624c53

Please sign in to comment.