From e3c551b9f63dc859b23a7faf03ddd93681c837d4 Mon Sep 17 00:00:00 2001 From: Daniel Hammer Date: Thu, 18 Jun 2026 12:21:19 +0200 Subject: [PATCH] fix: fix off-by-one in tabcompletion module --- programs/src/shell/tabcompletion.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/programs/src/shell/tabcompletion.cpp b/programs/src/shell/tabcompletion.cpp index fb42f23..ad34788 100644 --- a/programs/src/shell/tabcompletion.cpp +++ b/programs/src/shell/tabcompletion.cpp @@ -134,7 +134,7 @@ int get_completions( // returns no. of results int inc = find_first_slash_pos(names[i]) + 1; if (montauk::starts_with(names[i] + inc, (const char*)string)) { - if (r > arrayMax) + if (r >= arrayMax) break; if (!is_executable(names[i])) @@ -154,7 +154,7 @@ int get_completions( // returns no. of results for (size_t i = 0; i < builtins_count; i++) { if (montauk::starts_with(shell_builtins[i], (const char*)string)) { - if (r > arrayMax) + if (r >= arrayMax) break; array[r] = (char *)shell_builtins[i]; @@ -180,7 +180,7 @@ int get_completions( // returns no. of results } if (montauk::starts_with(cwd_entry_path, (const char*)string)) { - if (r > arrayMax) + if (r >= arrayMax) break; array[r] = (char *)cwd_entry_path;