Git: Fix bad access to temporary storage

+ limit the fix to cases with HOMESHARE.

Change-Id: Ic108ab49eb3b64d5e1d302466c74610acc412175
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Orgad Shaneh
2022-01-31 14:32:05 +02:00
committed by Orgad Shaneh
parent 74ea443ebf
commit 2ee739b362

View File

@@ -2225,10 +2225,12 @@ Environment GitClient::processEnvironment() const
environment.prependOrSetPath(FilePath::fromUserInput(gitPath));
if (HostOsInfo::isWindowsHost() && settings().winSetHomeEnvironment.value()) {
QString homePath;
if (const char *homeDrive = qgetenv("HOMEDRIVE"))
homePath = QString::fromLocal8Bit(homeDrive) + QString::fromLocal8Bit(qgetenv("HOMEPATH"));
else
if (qEnvironmentVariableIsEmpty("HOMESHARE")) {
homePath = QDir::toNativeSeparators(QDir::homePath());
} else {
homePath = QString::fromLocal8Bit(qgetenv("HOMEDRIVE"))
+ QString::fromLocal8Bit(qgetenv("HOMEPATH"));
}
environment.set("HOME", homePath);
}
environment.set("GIT_EDITOR", m_disableEditor ? "true" : m_gitQtcEditor);