mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 06:05:39 +08: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
|
@ -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 New Issue
Block a user