aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2020-09-01 20:56:03 +0200
committerPřemysl Eric Janouch <p@janouch.name>2020-09-01 20:56:03 +0200
commitee5317f86520392dc8723fd808855930c41f5302 (patch)
treefe61f3a73e90fb4f30e882181d4013581c37da56
parent20558ecd2b0b9e0d5a7878e4eaba8cc2dfde2f1b (diff)
downloadjson-rpc-shell-ee5317f86520392dc8723fd808855930c41f5302.tar.gz
json-rpc-shell-ee5317f86520392dc8723fd808855930c41f5302.tar.xz
json-rpc-shell-ee5317f86520392dc8723fd808855930c41f5302.zip
json-rpc-test-server: reject non-null params in "ping"
-rw-r--r--json-rpc-test-server.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/json-rpc-test-server.c b/json-rpc-test-server.c
index 8c51ac4..564c1a7 100644
--- a/json-rpc-test-server.c
+++ b/json-rpc-test-server.c
@@ -1449,7 +1449,10 @@ static json_t *
json_rpc_ping (struct server_context *ctx, json_t *params)
{
(void) ctx;
- (void) params;
+
+ if (params && !json_is_null (params))
+ return json_rpc_response (NULL, NULL,
+ json_rpc_error (JSON_RPC_ERROR_INVALID_PARAMS, NULL));
return json_rpc_response (NULL, json_string ("pong"), NULL);
}