[ros-diffs] [weiden] 16555: only NULL-terminate the string in
GetEnvironmentVariableW if the buffer size is greater than 0.
Thanks to Joseph Galbraith for the hint
weiden at svn.reactos.com
weiden at svn.reactos.com
Wed Jul 13 18:36:32 CEST 2005
only NULL-terminate the string in GetEnvironmentVariableW if the buffer
size is greater than 0. Thanks to Joseph Galbraith for the hint
Modified: trunk/reactos/lib/kernel32/misc/env.c
_____
Modified: trunk/reactos/lib/kernel32/misc/env.c
--- trunk/reactos/lib/kernel32/misc/env.c 2005-07-13 15:46:59 UTC
(rev 16554)
+++ trunk/reactos/lib/kernel32/misc/env.c 2005-07-13 16:36:24 UTC
(rev 16555)
@@ -158,9 +158,12 @@
}
}
- /* 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));
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050713/a1b37686/attachment.html
More information about the Ros-diffs
mailing list