diff --git a/reactos/lib/kernel32/misc/env.c b/reactos/lib/kernel32/misc/env.c index e5df9875f38..54b37da3dab 100644 --- a/reactos/lib/kernel32/misc/env.c +++ b/reactos/lib/kernel32/misc/env.c @@ -70,7 +70,7 @@ GetEnvironmentVariableA ( SetLastErrorByStatus (Status); if (Status == STATUS_BUFFER_TOO_SMALL) { - return VarValueU.Length / sizeof(WCHAR) + sizeof(WCHAR); + return VarValueU.Length / sizeof(WCHAR) + 1; } else { @@ -91,7 +91,7 @@ GetEnvironmentVariableA ( /* free unicode variable name string */ RtlFreeUnicodeString (&VarNameU); - return (VarValueU.Length / sizeof(WCHAR) + sizeof(WCHAR)); + return (VarValueU.Length / sizeof(WCHAR) + 1); } @@ -125,7 +125,7 @@ GetEnvironmentVariableW ( SetLastErrorByStatus (Status); if (Status == STATUS_BUFFER_TOO_SMALL) { - return (VarValue.Length / sizeof(WCHAR)) + sizeof(WCHAR); + return (VarValue.Length / sizeof(WCHAR)) + 1; } else { @@ -133,7 +133,7 @@ GetEnvironmentVariableW ( } } - return (VarValue.Length / sizeof(WCHAR) + sizeof(WCHAR)); + return (VarValue.Length / sizeof(WCHAR) + 1); }