IPC_SUBSCRIBE ensure request object is an array

Fixes #3320
This commit is contained in:
Aidan Harris 2018-12-22 10:52:27 +00:00 committed by emersion
parent 88d96bc41f
commit 0d3cf36c85

View file

@ -664,7 +664,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
{ {
// TODO: Check if they're permitted to use these events // TODO: Check if they're permitted to use these events
struct json_object *request = json_tokener_parse(buf); struct json_object *request = json_tokener_parse(buf);
if (request == NULL) { if (request == NULL || !json_object_is_type(request, json_type_array)) {
const char msg[] = "{\"success\": false}"; const char msg[] = "{\"success\": false}";
client_valid = ipc_send_reply(client, msg, strlen(msg)); client_valid = ipc_send_reply(client, msg, strlen(msg));
wlr_log(WLR_INFO, "Failed to parse subscribe request"); wlr_log(WLR_INFO, "Failed to parse subscribe request");