forked from github/server
CID 22434 Ignoring number of bytes read
also potential missing null-termination
This commit is contained in:
parent
165d287d59
commit
0c5ef21c10
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue