mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-10 09:34:22 +01:00
Check return value of json_get_params(...) call in json_getlog(...) and json_getpeers(...)
All other users of json_get_params(...) check the return value:
```
lightningd/chaintopology.c: if (!json_get_params(buffer, params,
lightningd/chaintopology.c: if (!json_get_params(buffer, params,
lightningd/dev_ping.c: if (!json_get_params(buffer, params,
lightningd/gossip_control.c: if (!json_get_params(buffer, params,
lightningd/invoice.c: if (!json_get_params(buffer, params,
lightningd/invoice.c: if (!json_get_params(buffer, params,
lightningd/invoice.c: if (!json_get_params(buffer, params,
lightningd/invoice.c: if (!json_get_params(buffer, params,
lightningd/invoice.c: if (!json_get_params(buffer, params, "label", &labeltok, NULL)) {
lightningd/invoice.c: if (!json_get_params(buffer, params,
lightningd/jsonrpc.c: if (!json_get_params(buffer, params,
lightningd/pay.c: if (!json_get_params(buffer, params,
lightningd/pay.c: if (!json_get_params(buffer, params,
lightningd/peer_control.c: if (!json_get_params(buffer, params,
lightningd/peer_control.c: if (!json_get_params(buffer, params,
lightningd/peer_control.c: if (!json_get_params(buffer, params,
lightningd/peer_control.c: if (!json_get_params(buffer, params,
lightningd/peer_control.c: if (!json_get_params(buffer, params,
lightningd/peer_control.c: if (!json_get_params(buffer, params,
wallet/walletrpc.c: if (!json_get_params(buffer, params,
wallet/walletrpc.c: if (!json_get_params(buffer, params, "tx", &txtok, NULL)) {
```
This commit is contained in:
committed by
Rusty Russell
parent
467ca0a996
commit
ab0c26be91
@@ -150,7 +150,10 @@ static void json_getlog(struct command *cmd,
|
||||
struct log_book *lr = cmd->ld->log_book;
|
||||
jsmntok_t *level;
|
||||
|
||||
json_get_params(buffer, params, "?level", &level, NULL);
|
||||
if (!json_get_params(buffer, params, "?level", &level, NULL)) {
|
||||
command_fail(cmd, "Invalid arguments");
|
||||
return;
|
||||
}
|
||||
|
||||
info.num_skipped = 0;
|
||||
|
||||
|
||||
@@ -945,7 +945,10 @@ static void json_getpeers(struct command *cmd,
|
||||
struct getpeers_args *gpa = tal(cmd, struct getpeers_args);
|
||||
|
||||
gpa->cmd = cmd;
|
||||
json_get_params(buffer, params, "?level", &leveltok, NULL);
|
||||
if (!json_get_params(buffer, params, "?level", &leveltok, NULL)) {
|
||||
command_fail(cmd, "Invalid arguments");
|
||||
return;
|
||||
}
|
||||
|
||||
if (leveltok) {
|
||||
gpa->ll = tal(gpa, enum log_level);
|
||||
|
||||
Reference in New Issue
Block a user