QProcessEnvironment: Permit magic cmd variables

The cmd shell inserts magic variables starting with a = into the
environment.

Task-number: QTCREATORBUG-8716
Change-Id: I2f140032aea4fb1d77633c6baf90d7b536e2812a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Daniel Teske 2013-02-08 12:32:14 +01:00 committed by The Qt Project
parent 67bed5616b
commit e7a242b27b

View File

@ -364,7 +364,8 @@ QProcessEnvironment QProcessEnvironment::systemEnvironment()
if (wchar_t *envStrings = GetEnvironmentStringsW()) {
for (const wchar_t *entry = envStrings; *entry; ) {
const int entryLen = int(wcslen(entry));
if (const wchar_t *equal = wcschr(entry, L'=')) {
// + 1 to permit magic cmd variable names starting with =
if (const wchar_t *equal = wcschr(entry + 1, L'=')) {
int nameLen = equal - entry;
QString name = QString::fromWCharArray(entry, nameLen);
QString value = QString::fromWCharArray(equal + 1, entryLen - nameLen - 1);