This is an automated email from the ASF dual-hosted git repository.
dahn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.git
The following commit(s) were added to refs/heads/main by this push:
new 5db5a5e autocomplete: prevent slice bounds panic (#196)
5db5a5e is described below
commit 5db5a5ecdd80414afe412e2b8067a02d19ac62c3
Author: Abhishek Kumar <[email protected]>
AuthorDate: Thu Nov 27 17:24:51 2025 +0100
autocomplete: prevent slice bounds panic (#196)
Signed-off-by: Abhishek Kumar <[email protected]>
---
vendor/github.com/chzyer/readline/complete.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vendor/github.com/chzyer/readline/complete.go
b/vendor/github.com/chzyer/readline/complete.go
index a5a2301..9e27ce3 100644
--- a/vendor/github.com/chzyer/readline/complete.go
+++ b/vendor/github.com/chzyer/readline/complete.go
@@ -51,7 +51,7 @@ func (o *opCompleter) truncateBufferAfterLastEqual(completion
[]rune) {
for i := len(bufRunes) - 1; i >= 0; i-- {
if bufRunes[i] == '=' {
prefix := bufRunes[i+1:] // part after '=' in buffer
- if len(prefix) > 0 && len(completion) > 0 &&
string(completion[:len(prefix)]) == string(prefix) {
+ if len(prefix) > 0 && len(completion) > len(prefix) &&
string(completion[:len(prefix)]) == string(prefix) {
o.op.buf.Set(bufRunes[:i+1]) // Keep content
till '='
}
break