Skip to content

Commit

Permalink
Merge pull request #200 from flaviojs/fix-null-dereference-read_file
Browse files Browse the repository at this point in the history
Fix null dereference in read_file.
  • Loading branch information
grossmj authored Mar 28, 2024
2 parents 3bf38c2 + 5478f7e commit 9cf7413
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/nvram_export.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ int read_file(const char *filename, u_char **data, size_t *data_len)
// data
if (data) {
*data = (u_char *)malloc((size_t)len);
if (*data == NULL) {
fclose(fd);
return(-1);
}
if (fread(*data, (size_t)len, 1, fd) != 1) {
free(*data);
*data = NULL;
Expand Down

0 comments on commit 9cf7413

Please sign in to comment.