From 29ef65c4586bc97071894c8f926605a83e9f7bc0 Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Fri, 18 Sep 2020 11:22:52 +0430 Subject: [PATCH] Shell: Fix Vector OOB access in `add_entry_to_cache()' Fixes #3530. --- Shell/Shell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shell/Shell.cpp b/Shell/Shell.cpp index adec2a70015..1344068485a 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);