1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

LibLine: Avoid OOB access when one of the suggestions is the prefix

This commit is contained in:
AnotherTest 2020-04-22 00:31:31 +04:30 committed by Andreas Kling
parent ef69f900c7
commit 730ca98698

View file

@ -385,7 +385,7 @@ String Editor::get_line(const String& prompt)
last_valid_suggestion_char = m_suggestions[0].text[common_suggestion_prefix];
for (const auto& suggestion : m_suggestions) {
if (suggestion.text.length() < common_suggestion_prefix || suggestion.text[common_suggestion_prefix] != last_valid_suggestion_char) {
if (suggestion.text.length() <= common_suggestion_prefix || suggestion.text[common_suggestion_prefix] != last_valid_suggestion_char) {
goto no_more_commons;
}
}