This commit is contained in:
simon987 2020-09-22 21:06:01 -04:00
parent d3bd53a5ea
commit ae283f77ad

View File

@ -535,8 +535,8 @@ void tag(struct mg_connection *nc, struct http_message *hm, struct mg_str *path)
} }
} }
char buf[8192]; char *buf = malloc(sizeof(char) * 8192);
snprintf(buf, sizeof(buf), snprintf(buf, 8192,
"{" "{"
" \"script\" : {" " \"script\" : {"
" \"source\": \"if (ctx._source.tag.contains(params.tag)) { ctx._source.tag.remove(ctx._source.tag.indexOf(params.tag)) }\"," " \"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 { } else {
cJSON_AddItemToArray(arr, cJSON_CreateString(arg_req->name)); cJSON_AddItemToArray(arr, cJSON_CreateString(arg_req->name));
char buf[8192]; char *buf = malloc(sizeof(char) * 8192);
snprintf(buf, sizeof(buf), snprintf(buf, 8192,
"{" "{"
" \"script\" : {" " \"script\" : {"
" \"source\": \"if(ctx._source.tag == null) {ctx._source.tag = new ArrayList()} ctx._source.tag.add(params.tag)\"," " \"source\": \"if(ctx._source.tag == null) {ctx._source.tag = new ArrayList()} ctx._source.tag.add(params.tag)\","