diff options
Diffstat (limited to 'src/common/util.c')
-rw-r--r-- | src/common/util.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/util.c b/src/common/util.c index 7d72a896f9..93e2ba8e14 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -2374,8 +2374,10 @@ read_file_to_str(const char *filename, int flags, struct stat *stat_out) } #endif - if ((uint64_t)(statbuf.st_size)+1 >= SIZE_T_CEILING) + if ((uint64_t)(statbuf.st_size)+1 >= SIZE_T_CEILING) { + close(fd); return NULL; + } string = tor_malloc((size_t)(statbuf.st_size+1)); |