summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-09-18 11:22:52 +0430
committerAndreas Kling <kling@serenityos.org>2020-09-19 00:38:41 +0200
commit29ef65c4586bc97071894c8f926605a83e9f7bc0 (patch)
tree1a8df41fa552e2d579a88a3130a959cddafd6aab
parenta43d9c4fe065a655579d4c06f6de5b2e5eecbb9f (diff)
downloadserenity-29ef65c4586bc97071894c8f926605a83e9f7bc0.zip
Shell: Fix Vector OOB access in `add_entry_to_cache()'
Fixes #3530.
-rw-r--r--Shell/Shell.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Shell/Shell.cpp b/Shell/Shell.cpp
index adec2a7001..1344068485 100644
--- a/Shell/Shell.cpp
+++ b/Shell/Shell.cpp
@@ -1047,7 +1047,7 @@ void Shell::add_entry_to_cache(const String& entry)
if (match)
return;
- while (strcmp(cached_path[index].characters(), entry.characters()) < 0) {
+ while (index < cached_path.size() && strcmp(cached_path[index].characters(), entry.characters()) < 0) {
index++;
}
cached_path.insert(index, entry);