summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-04-22 00:31:31 +0430
committerAndreas Kling <kling@serenityos.org>2020-04-22 11:35:53 +0200
commit730ca986988036c7c29e56047f2be508c2241e53 (patch)
tree9c8748d844c837fdbbf3573b04277a082b207160 /Libraries
parentef69f900c79d4c6a415a197f30606b97a49eb6b4 (diff)
downloadserenity-730ca986988036c7c29e56047f2be508c2241e53.zip
LibLine: Avoid OOB access when one of the suggestions is the prefix
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibLine/Editor.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Libraries/LibLine/Editor.cpp b/Libraries/LibLine/Editor.cpp
index 84906d365c..43fc388d34 100644
--- a/Libraries/LibLine/Editor.cpp
+++ b/Libraries/LibLine/Editor.cpp
@@ -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;
}
}