diff --git a/src/kernel/jsonconf.c b/src/kernel/jsonconf.c index 9e23c3360..4602008f5 100644 --- a/src/kernel/jsonconf.c +++ b/src/kernel/jsonconf.c @@ -839,8 +839,9 @@ static void json_include(cJSON *json) { fseek(F, 0, SEEK_END); sz = ftell(F); rewind(F); - data = malloc(sz); - fread(data, 1, sz, F); + data = malloc(sz+1); + sz = fread(data, 1, sz, F); + data[sz] = 0; fclose(F); config = cJSON_Parse(data); free(data);