Commit e365aee9 authored by Nick Mathewson's avatar Nick Mathewson 🌉
Browse files

Avoid assertion on read_file_to_str() with size==SIZE_T_CEILING-1

Spotted by doors, fixes bug 2326.
parent e09ab697
o Minor bugfixes
- Fix a bug where we would assert if we ever had a file (or another file read directly into
memory) of exactly SIZE_T_CEILING bytes. Found by doors; fixes
bug 2326; bugfix on
......@@ -1936,7 +1936,7 @@ read_file_to_str(const char *filename, int flags, struct stat *stat_out)
return NULL;
if ((uint64_t)(statbuf.st_size)+1 > SIZE_T_CEILING)
if ((uint64_t)(statbuf.st_size)+1 >= SIZE_T_CEILING)
return NULL;
string = tor_malloc((size_t)(statbuf.st_size+1));
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment