rsys

Basic data structures and low-level features
git clone git://git.meso-star.fr/rsys.git
Log | Files | Refs | README | LICENSE

commit abe30cec37600ad3c4ad49ccee0cde5ffdd65480
parent 8bc1b3e34a5276a6cecc9920ef2d2ddd4aa999ea
Author: vaplv <vaplv@free.fr>
Date:   Mon,  8 May 2017 15:40:11 +0200

Fix a possible invalid big buffer memory write

Diffstat:
Msrc/big_buffer.h | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/big_buffer.h b/src/big_buffer.h @@ -26,7 +26,7 @@ /* Internal enumerate used to define the mode of the buffered data */ enum bigbuf_mode__ { BIGBUF_READ__, BIGBUF_WRITE__ }; -enum bigbuf_flag { +enum bigbuf_flag { BIGBUF_LOAD_STREAM = BIT(1) }; @@ -320,7 +320,7 @@ BIGBUF_FUNC__(at)(struct BIGBUF__* bigbuf, const size_t at, BIGBUF_DATA* data) goto error; } - buf_size = MMIN(bigbuf->size - buf_index, BIGBUF_BUFSIZE); + buf_size = MMIN(bigbuf->size - buf_index, bigbuf->buf.capacity); bigbuf->buf.size = buf_size; read_size = fread(buf_data, sizeof(BIGBUF_DATA), buf_size, bigbuf->file);