diff options
author | Vito Caputo <vcaputo@gnugeneration.com> | 2016-08-04 13:52:02 -0700 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-08-04 22:52:02 +0200 |
commit | c2d11a630287631d3b401a5cf300ea3655e21fd1 (patch) | |
tree | 57fc500bbd690aac7a08f0eca0f7d402d3a0dba6 /src/basic/mempool.h | |
parent | 80edac2090c56a72ee731f9c61ecb53d3abcb541 (diff) |
fileio: fix read_full_stream() bugs (#3887)
read_full_stream() _always_ allocated twice the memory needed, due to
only breaking the realloc() && fread() loop when fread() returned 0,
requiring another iteration and exponentially enlarged buffer just to
discover the EOF condition.
This also caused file sizes >2MiB && <= 4MiB to erroneously be treated
as E2BIG, due to the inappropriately doubled buffer size exceeding
4*1024*1024.
Also made the 4*1024*1024 magic number a READ_FULL_BYTES_MAX constant.
Diffstat (limited to 'src/basic/mempool.h')
0 files changed, 0 insertions, 0 deletions