projects
/
nextcloud-desktop.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
93afc2a
)
Folder wizard: Fix infinite loop for bad paths #7041
author
Christian Kamm
<mail@ckamm.de>
Mon, 18 Feb 2019 13:32:47 +0000
(14:32 +0100)
committer
Kevin Ottens
<kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:42 +0000
(10:58 +0100)
src/gui/folderman.cpp
patch
|
blob
|
history
diff --git
a/src/gui/folderman.cpp
b/src/gui/folderman.cpp
index b690a86d44e4dbf9447fa281716240270e523086..3991ca4b46ad804eb0b223cac269b0da932190ba 100644
(file)
--- a/
src/gui/folderman.cpp
+++ b/
src/gui/folderman.cpp
@@
-1479,7
+1479,16
@@
static QString canonicalPath(const QString &path)
{
QFileInfo selFile(path);
if (!selFile.exists()) {
- return canonicalPath(selFile.dir().path()) + '/' + selFile.fileName();
+ const auto parentPath = selFile.dir().path();
+
+ // It's possible for the parentPath to match the path
+ // (possibly we've arrived at a non-existant drive root on Windows)
+ // and recursing would be fatal.
+ if (parentPath == path) {
+ return path;
+ }
+
+ return canonicalPath(parentPath) + '/' + selFile.fileName();
}
return selFile.canonicalFilePath();
}