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);
|
fseek(F, 0, SEEK_END);
|
||||||
sz = ftell(F);
|
sz = ftell(F);
|
||||||
rewind(F);
|
rewind(F);
|
||||||
data = malloc(sz);
|
data = malloc(sz+1);
|
||||||
fread(data, 1, sz, F);
|
sz = fread(data, 1, sz, F);
|
||||||
|
data[sz] = 0;
|
||||||
fclose(F);
|
fclose(F);
|
||||||
config = cJSON_Parse(data);
|
config = cJSON_Parse(data);
|
||||||
free(data);
|
free(data);
|
||||||
|
|
Loading…
Reference in New Issue