From 2ee739b3627751bc7e4a9eb25c8461842f163b8c Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 31 Jan 2022 14:32:05 +0200 Subject: [PATCH] Git: Fix bad access to temporary storage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + limit the fix to cases with HOMESHARE. Change-Id: Ic108ab49eb3b64d5e1d302466c74610acc412175 Reviewed-by: Alessandro Portale Reviewed-by: André Hartmann --- src/plugins/git/gitclient.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 91e441ca682..3a51e2c043b 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -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);