Commit b4cdfcc7 authored by Timothy B. Terriberry's avatar Timothy B. Terriberry
Browse files

Fix a typo in op_mem_read().

We should copy the minimum of the buffer size and the remaining
 bytes, not the maximum.
Fixes #1927.
parent 9d825963
......@@ -110,7 +110,7 @@ static int op_mem_read(void *_stream,unsigned char *_ptr,int _buf_size){
/*Check for EOF.*/
if(pos>=size)return 0;
/*Check for a short read.*/
_buf_size=(int)OP_MAX(size-pos,_buf_size);
_buf_size=(int)OP_MIN(size-pos,_buf_size);
memcpy(_ptr,stream->data+pos,_buf_size);
pos+=_buf_size;
stream->pos=pos;
......
Markdown is supported
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