fix: fix off-by-one in tabcompletion module
This commit is contained in:
@@ -134,7 +134,7 @@ int get_completions( // returns no. of results
|
|||||||
int inc = find_first_slash_pos(names[i]) + 1;
|
int inc = find_first_slash_pos(names[i]) + 1;
|
||||||
|
|
||||||
if (montauk::starts_with(names[i] + inc, (const char*)string)) {
|
if (montauk::starts_with(names[i] + inc, (const char*)string)) {
|
||||||
if (r > arrayMax)
|
if (r >= arrayMax)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!is_executable(names[i]))
|
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++) {
|
for (size_t i = 0; i < builtins_count; i++) {
|
||||||
if (montauk::starts_with(shell_builtins[i], (const char*)string)) {
|
if (montauk::starts_with(shell_builtins[i], (const char*)string)) {
|
||||||
if (r > arrayMax)
|
if (r >= arrayMax)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
array[r] = (char *)shell_builtins[i];
|
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 (montauk::starts_with(cwd_entry_path, (const char*)string)) {
|
||||||
if (r > arrayMax)
|
if (r >= arrayMax)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
array[r] = (char *)cwd_entry_path;
|
array[r] = (char *)cwd_entry_path;
|
||||||
|
|||||||
Reference in New Issue
Block a user