swaymsg: set limit for max JSON depth

This commit is contained in:
Jason Nader 2021-10-19 09:27:26 +09:00
parent db70f6496c
commit 66b318bb71
No known key found for this signature in database
GPG key ID: EE220FCAA09AF23D

View file

@ -1,5 +1,4 @@
#define _POSIX_C_SOURCE 200809L #define _POSIX_C_SOURCE 200809L
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -481,7 +480,7 @@ int main(int argc, char **argv) {
char *resp = ipc_single_command(socketfd, type, command, &len); char *resp = ipc_single_command(socketfd, type, command, &len);
// pretty print the json // pretty print the json
json_tokener *tok = json_tokener_new_ex(INT_MAX); json_tokener *tok = json_tokener_new_ex(1024);
json_object *obj = json_tokener_parse_ex(tok, resp, -1); json_object *obj = json_tokener_parse_ex(tok, resp, -1);
enum json_tokener_error err = json_tokener_get_error(tok); enum json_tokener_error err = json_tokener_get_error(tok);
json_tokener_free(tok); json_tokener_free(tok);
@ -520,7 +519,7 @@ int main(int argc, char **argv) {
break; break;
} }
json_tokener *tok = json_tokener_new_ex(INT_MAX); json_tokener *tok = json_tokener_new_ex(1024);
json_object *obj = json_tokener_parse_ex(tok, reply->payload, -1); json_object *obj = json_tokener_parse_ex(tok, reply->payload, -1);
enum json_tokener_error err = json_tokener_get_error(tok); enum json_tokener_error err = json_tokener_get_error(tok);
json_tokener_free(tok); json_tokener_free(tok);