fix bug in read buffer memcpy that could result in oob read on rollover