mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 12:23:25 +00:00
only NULL-terminate the string in GetEnvironmentVariableW if the buffer size is greater than 0. Thanks to Joseph Galbraith for the hint
svn path=/trunk/; revision=16555
This commit is contained in:
@@ -158,9 +158,12 @@ GetEnvironmentVariableW (
|
||||
}
|
||||
}
|
||||
|
||||
/* make sure the string is NULL-terminated! RtlQueryEnvironmentVariable_U
|
||||
only terminates it if MaximumLength < Length */
|
||||
VarValue.Buffer[VarValue.Length / sizeof(WCHAR)] = L'\0';
|
||||
if (nSize != 0)
|
||||
{
|
||||
/* make sure the string is NULL-terminated! RtlQueryEnvironmentVariable_U
|
||||
only terminates it if MaximumLength < Length */
|
||||
VarValue.Buffer[VarValue.Length / sizeof(WCHAR)] = L'\0';
|
||||
}
|
||||
|
||||
return (VarValue.Length / sizeof(WCHAR));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user