mirror of
https://github.com/simon987/sist2.git
synced 2025-04-16 08:56:45 +00:00
Fix heap buffer overflow warning
This commit is contained in:
parent
3379d5ce71
commit
5d5d9c3092
@ -436,7 +436,11 @@ char *elastic_get_status() {
|
||||
status[0] = '\0';
|
||||
|
||||
if (r->status_code == 200) {
|
||||
json = cJSON_Parse(r->body);
|
||||
char *tmp = malloc(r->size + 1);
|
||||
memcpy(tmp, r->body, r->size);
|
||||
*(tmp + r->size) = '\0';
|
||||
json = cJSON_Parse(tmp);
|
||||
free(tmp);
|
||||
const cJSON *metadata = cJSON_GetObjectItem(json, "metadata");
|
||||
if (metadata != NULL) {
|
||||
const cJSON *indices = cJSON_GetObjectItem(metadata, "indices");
|
||||
|
Loading…
x
Reference in New Issue
Block a user