mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2026-02-04 12:57:43 +01:00
Avoid strlen on uninitialized memory
Update fsize by the actual read bytes from fread, because ftell will always return 4k on sysfs files. Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
This commit is contained in:
parent
ddf03e43c7
commit
cdf945ac57
1 changed files with 1 additions and 1 deletions
|
|
@ -1629,7 +1629,7 @@ char* readFileContent(char *filepath)
|
|||
fseek(f, 0, SEEK_SET);
|
||||
|
||||
char *filecontent = dmmalloc(fsize + 1);
|
||||
fread(filecontent, 1, fsize, f);
|
||||
fsize = fread(filecontent, 1, fsize, f);
|
||||
fclose(f);
|
||||
|
||||
filecontent[fsize] = 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue