diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-09-02 13:29:11 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-09-02 13:29:11 -0400 |
commit | 07a16b33724c90c74a96e42f89ccd1ccdcccf2a7 (patch) | |
tree | 1a4adb6627cf2317609a4da857bbdb17be34605a /src/common | |
parent | 1a2f2c163f68f888e45908e6493a273eb48b6236 (diff) | |
download | tor-07a16b33724c90c74a96e42f89ccd1ccdcccf2a7.tar.gz tor-07a16b33724c90c74a96e42f89ccd1ccdcccf2a7.zip |
Add an assertion to read_file_to_str_until_eof
The clangalyzer doesn't believe our math here. I'm pretty sure our
math is right. Also, add some unit tests.
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/util.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c index 3f298cd9c4..a7a7fcbea3 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -2357,6 +2357,7 @@ read_file_to_str_until_eof(int fd, size_t max_bytes_to_read, size_t *sz_out) pos += r; } while (r > 0 && pos < max_bytes_to_read); + tor_assert(pos < string_max); *sz_out = pos; string[pos] = '\0'; return string; |