summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-01-13 22:03:51 +0300
committerAndrei Karas <akaras@inbox.ru>2018-01-13 22:04:26 +0300
commit43abb22c0626529c8465f25bd62b813898abe840 (patch)
treef471752b2b696e0ed3d4747fae859ecbd21bf674
parent1b9913feb9541fc8a013b372bab1f77f4f9aca73 (diff)
downloadmv-43abb22c0626529c8465f25bd62b813898abe840.tar.gz
mv-43abb22c0626529c8465f25bd62b813898abe840.tar.bz2
mv-43abb22c0626529c8465f25bd62b813898abe840.tar.xz
mv-43abb22c0626529c8465f25bd62b813898abe840.zip
Dont allow use realpath function if in path present "(unreachable)".
Possible glibc bug mitigation.
-rw-r--r--src/fs/paths.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/fs/paths.cpp b/src/fs/paths.cpp
index 31052b7bb..db9742daf 100644
--- a/src/fs/paths.cpp
+++ b/src/fs/paths.cpp
@@ -75,6 +75,10 @@ namespace
std::string getRealPath(const std::string &str)
{
+#if defined(__GLIBC__)
+ if (str.find("(unreachable)") != std::string::npos)
+ return "";
+#endif // defined(__GLIBC__)
#if defined(__OpenBSD__) || defined(__ANDROID__) || defined(__native_client__)
char *realPath = reinterpret_cast<char*>(calloc(PATH_MAX, sizeof(char)));
if (!realPath)