Coverity-CWE 22: Improper Limitation of a Pathname to a Restricted Directory ('Path...
[osm/common.git] / osm_common / fsmongo.py
index 4f4e5eb..2e47039 100644 (file)
@@ -235,7 +235,9 @@ class FsMongo(FsBase):
                     if e.errno != errno.ENOENT:
                         # This is probably permission denied or worse
                         raise
-                os.symlink(link, file_path)
+                os.symlink(
+                    link, os.path.realpath(os.path.normpath(os.path.abspath(file_path)))
+                )
             else:
                 folder = os.path.dirname(file_path)
                 if folder not in valid_paths: