mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Fix off-by-one in complete_cmd_desc
The substring constructor (string(str, pos)) includes pos, so we need to add one. Also be careful not to go over the length again.
This commit is contained in:
parent
ebc5e18956
commit
8de5af5f9e
1 changed files with 2 additions and 1 deletions
|
@ -545,7 +545,8 @@ void completer_t::complete_cmd_desc(const wcstring &str) {
|
|||
wcstring cmd;
|
||||
size_t pos = str.find_last_of(L'/');
|
||||
if (pos != std::string::npos) {
|
||||
cmd = wcstring(str, pos);
|
||||
if (pos + 1 > str.length()) return;
|
||||
cmd = wcstring(str, pos + 1);
|
||||
} else {
|
||||
cmd = str;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue