From ae283f77ad866971079ca86da8cfcdddee4def5f Mon Sep 17 00:00:00 2001 From: simon987 Date: Tue, 22 Sep 2020 21:06:01 -0400 Subject: [PATCH] Fix #112 --- src/web/serve.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/web/serve.c b/src/web/serve.c index 17f6441..eadf930 100644 --- a/src/web/serve.c +++ b/src/web/serve.c @@ -535,8 +535,8 @@ void tag(struct mg_connection *nc, struct http_message *hm, struct mg_str *path) } } - char buf[8192]; - snprintf(buf, sizeof(buf), + char *buf = malloc(sizeof(char) * 8192); + snprintf(buf, 8192, "{" " \"script\" : {" " \"source\": \"if (ctx._source.tag.contains(params.tag)) { ctx._source.tag.remove(ctx._source.tag.indexOf(params.tag)) }\"," @@ -555,8 +555,8 @@ void tag(struct mg_connection *nc, struct http_message *hm, struct mg_str *path) } else { cJSON_AddItemToArray(arr, cJSON_CreateString(arg_req->name)); - char buf[8192]; - snprintf(buf, sizeof(buf), + char *buf = malloc(sizeof(char) * 8192); + snprintf(buf, 8192, "{" " \"script\" : {" " \"source\": \"if(ctx._source.tag == null) {ctx._source.tag = new ArrayList()} ctx._source.tag.add(params.tag)\","