diff options
author | Thomas Lübking <thomas.luebking@gmail.com> | 2016-09-18 13:06:10 (GMT) |
---|---|---|
committer | Thomas Lübking <thomas.luebking@gmail.com> | 2016-09-22 19:03:35 (GMT) |
commit | 39b34a9109ca2a995bbe46a365efa105ecbdf968 (patch) | |
tree | e0c32afc0bb77a4a583389267241d8a159046764 /util | |
parent | facb42fc3537a8a1288b3da38b38fa533ac1d309 (diff) | |
download | fluxbox-39b34a9109ca2a995bbe46a365efa105ecbdf968.zip fluxbox-39b34a9109ca2a995bbe46a365efa105ecbdf968.tar.bz2 |
fix segfault when completing ~ or .
ie. w/o any / in the given path we'll get an irregular split point and
thus out of bounds array access
Diffstat (limited to 'util')
-rw-r--r-- | util/fbrun/FbRun.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc index b697187..19f6444 100644 --- a/util/fbrun/FbRun.cc +++ b/util/fbrun/FbRun.cc | |||
@@ -462,6 +462,10 @@ void FbRun::tabCompleteApps() { | |||
462 | if (prefix.at(0) == '/' || prefix.at(0) == '.' || prefix.at(0) == '~') { | 462 | if (prefix.at(0) == '/' || prefix.at(0) == '.' || prefix.at(0) == '~') { |
463 | // we're completing a directory, find subdirs | 463 | // we're completing a directory, find subdirs |
464 | split = prefix.find_last_of('/'); | 464 | split = prefix.find_last_of('/'); |
465 | if (split == std::string::npos) { | ||
466 | split = prefix.size(); | ||
467 | prefix.append("/"); | ||
468 | } | ||
465 | prefix = prefix.substr(0, split+1); | 469 | prefix = prefix.substr(0, split+1); |
466 | if (prefix != m_last_completion_path) { | 470 | if (prefix != m_last_completion_path) { |
467 | m_files.clear(); | 471 | m_files.clear(); |