From 1996f401e0867195b4b93b9b516e542b0ad489ff Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 23 Nov 2020 16:19:31 +0100 Subject: [PATCH] Fixed last block searched for strings to yield invalid results --- source/views/view_strings.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/views/view_strings.cpp b/source/views/view_strings.cpp index 2424703d5..c2d707e2e 100644 --- a/source/views/view_strings.cpp +++ b/source/views/view_strings.cpp @@ -36,9 +36,10 @@ namespace hex { std::vector buffer(1024, 0x00); u32 foundCharacters = 0; for (u64 offset = 0; offset < this->m_dataProvider->getSize(); offset += buffer.size()) { - this->m_dataProvider->read(offset, buffer.data(), buffer.size()); + size_t readSize = std::min(buffer.size(), this->m_dataProvider->getSize() - offset); + this->m_dataProvider->read(offset, buffer.data(), readSize); - for (u32 i = 0; i < buffer.size(); i++) { + for (u32 i = 0; i < readSize; i++) { if (buffer[i] >= 0x20 && buffer[i] <= 0x7E) foundCharacters++; else {