HexEditor: find_and_highlight: Limit search to remaining buffer size
This commit is contained in:
parent
df7d938808
commit
3bbae6c18b
Notes:
sideshowbarker
2024-07-18 17:42:33 +09:00
Author: https://github.com/bcoles Commit: https://github.com/SerenityOS/serenity/commit/3bbae6c18bd Pull-request: https://github.com/SerenityOS/serenity/pull/7311
1 changed files with 1 additions and 1 deletions
|
@ -563,7 +563,7 @@ int HexEditor::find_and_highlight(ByteBuffer& needle, int start)
|
|||
if (m_buffer.is_empty())
|
||||
return -1;
|
||||
|
||||
auto raw_offset = memmem(m_buffer.data() + start, m_buffer.size(), needle.data(), needle.size());
|
||||
auto raw_offset = memmem(m_buffer.data() + start, m_buffer.size() - start, needle.data(), needle.size());
|
||||
if (raw_offset == NULL)
|
||||
return -1;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue