CID 22434 Ignoring number of bytes read

This commit is contained in:
Enno Rehling 2015-11-04 12:19:16 +01:00
parent b7b1ae43c2
commit 5887e8e48f
1 changed files with 3 additions and 2 deletions

View File

@ -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);