diff --git a/src/cas/generic/inBuf.cc b/src/cas/generic/inBuf.cc index 4e62540fa..b9e9a50db 100644 --- a/src/cas/generic/inBuf.cc +++ b/src/cas/generic/inBuf.cc @@ -161,7 +161,9 @@ void inBuf::expandBuffer () bufSizeT max = this->memMgr.maxSize(); if ( this->bufSize < max ) { casBufferParm bufParm = this->memMgr.allocate ( max ); - memcpy ( bufParm.pBuf, &this->pBuf[this->nextReadIndex], this->bytesPresent () ); + bufSizeT unprocessedBytes = this->bytesPresent (); + memcpy ( bufParm.pBuf, &this->pBuf[this->nextReadIndex], unprocessedBytes ); + this->bytesInBuffer = unprocessedBytes; this->nextReadIndex = 0u; this->memMgr.release ( this->pBuf, this->bufSize ); this->pBuf = bufParm.pBuf;