aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/buildgraph/productinstaller.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2017-02-28 17:34:27 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2017-03-01 09:26:27 +0000
commit779de6dde45e8173eff748dcb311c60c58e4ae60 (patch)
treeccbaf5a6c139c2f16e0255c7cfd3cfc62f923098 /src/lib/corelib/buildgraph/productinstaller.cpp
parentc1374051a6ec00e0fe725acbab5f02a8f063a682 (diff)
Prevent files from getting installed outside the install root
That was possible by using ".." in install dir or install prefix. Task-number: QTCREATORBUG-17790 Change-Id: Ib947b11fe361bc061c40b651a0f4a5a4dd7b3074 Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/buildgraph/productinstaller.cpp')
-rw-r--r--src/lib/corelib/buildgraph/productinstaller.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/corelib/buildgraph/productinstaller.cpp b/src/lib/corelib/buildgraph/productinstaller.cpp
index d0d6dab55..935bdd0b1 100644
--- a/src/lib/corelib/buildgraph/productinstaller.cpp
+++ b/src/lib/corelib/buildgraph/productinstaller.cpp
@@ -131,6 +131,12 @@ QString ProductInstaller::targetFilePath(const TopLevelProject *project,
QString targetFilePath;
if (installSourceBase.isEmpty()) {
+ if (!targetDir.startsWith(options.installRoot())) {
+ throw ErrorInfo(Tr::tr("Cannot install '%1', because target directory '%2' "
+ "is outside of install root '%3'")
+ .arg(sourceFilePath, targetDir, options.installRoot()));
+ }
+
// This has the same effect as if installSourceBase would equal the directory of the file.
targetFilePath = FileInfo::fileName(sourceFilePath);
} else {