mirror of
https://github.com/swaywm/sway.git
synced 2024-12-28 16:06:37 +01:00
swaymsg: use INT_MAX max JSON depth when parsing IPC response
Same reasoning as fe11caeac9
.
Without this, swaymsg would fail with a cryptic error message
when the JSON was nested too deep.
This commit is contained in:
parent
119f31edb4
commit
f873bcc4e1
1 changed files with 7 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
#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>
|
||||||
|
@ -480,7 +481,9 @@ 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_object *obj = json_tokener_parse(resp);
|
json_tokener *tok = json_tokener_new_ex(INT_MAX);
|
||||||
|
json_object *obj = json_tokener_parse_ex(tok, resp, -1);
|
||||||
|
json_tokener_free(tok);
|
||||||
if (obj == NULL) {
|
if (obj == NULL) {
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
fprintf(stderr, "ERROR: Could not parse json response from ipc. "
|
fprintf(stderr, "ERROR: Could not parse json response from ipc. "
|
||||||
|
@ -517,7 +520,9 @@ int main(int argc, char **argv) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
json_object *obj = json_tokener_parse(reply->payload);
|
json_tokener *tok = json_tokener_new_ex(INT_MAX);
|
||||||
|
json_object *obj = json_tokener_parse_ex(tok, reply->payload, -1);
|
||||||
|
json_tokener_free(tok);
|
||||||
if (obj == NULL) {
|
if (obj == NULL) {
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
fprintf(stderr, "ERROR: Could not parse json response from"
|
fprintf(stderr, "ERROR: Could not parse json response from"
|
||||||
|
|
Loading…
Reference in a new issue