Fix buffer overread