Alexandre Julliard : ntdll: Fix buffer allocation size in get_env_var().

Alexandre Julliard julliard at winehq.org
Wed Apr 21 15:57:53 CDT 2021


Module: wine
Branch: master
Commit: aaa501fe93fb7140b472850060d652613406307f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=aaa501fe93fb7140b472850060d652613406307f

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Apr 21 17:06:43 2021 +0200

ntdll: Fix buffer allocation size in get_env_var().

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 9f614db01c5..38dd276608b 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2593,7 +2593,7 @@ static NTSTATUS get_env_var( const WCHAR *name, SIZE_T extra, UNICODE_STRING *re
 
     for (;;)
     {
-        ret->Buffer = RtlAllocateHeap( GetProcessHeap(), 0, size );
+        ret->Buffer = RtlAllocateHeap( GetProcessHeap(), 0, size * sizeof(WCHAR) );
         status = RtlQueryEnvironmentVariable( NULL, name, wcslen(name),
                                               ret->Buffer, size - extra - 1, &len );
         if (!status)




More information about the wine-cvs mailing list