Skip to content

Commit

Permalink
mcfg: add missing NULL terminator to read data in mcfg_parse_from_file
Browse files Browse the repository at this point in the history
  • Loading branch information
MarieEckert committed Nov 15, 2024
1 parent 593f856 commit 9c43e18
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ mcfg_parse_result_t mcfg_parse_from_file(const char *path) {
const size_t data_size = ftell(raw_file);
rewind(raw_file);

char *data = malloc(data_size);
char *data = malloc(data_size + 1);
if (data == NULL) {
fclose(raw_file);

Expand All @@ -431,6 +431,7 @@ mcfg_parse_result_t mcfg_parse_from_file(const char *path) {

fclose(raw_file);

data[data_size] = 0;
result = mcfg_parse(data);
free(data);

Expand Down

0 comments on commit 9c43e18

Please sign in to comment.