diff options
-rw-r--r-- | swaybar/ipc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/swaybar/ipc.c b/swaybar/ipc.c index 05238d8b..a64aa1ab 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c @@ -547,7 +547,16 @@ bool handle_ipc_readable(struct swaybar *bar) { return false; } - json_tokener *tok = json_tokener_new_ex(INT_MAX); + // The default depth of 32 is too small to represent some nested layouts, but + // we can't pass INT_MAX here because json-c (as of this writing) prefaults + // all the memory for its stack. + json_tokener *tok = json_tokener_new_ex(256); + if (!tok) { + sway_log_errno(SWAY_ERROR, "failed to create tokener"); + free_ipc_response(resp); + return false; + } + json_object *result = json_tokener_parse_ex(tok, resp->payload, -1); enum json_tokener_error err = json_tokener_get_error(tok); json_tokener_free(tok); |