Skip to content

Commit c20ec94

Browse files
committed
[KERNEL32] Check for null buffer in GetEnviornmentVariableW
Checks if lpBuffer is null before writing the null terminator to the end of it. This prevents some crashes in the kernel32 winetest sync to wine-10.0.
1 parent 02875de commit c20ec94

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎dll/win32/kernel32/client/environ.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ GetEnvironmentVariableW(IN LPCWSTR lpName,
204204
return 0;
205205
}
206206

207-
lpBuffer[VarValue.Length / sizeof(WCHAR)] = UNICODE_NULL;
207+
if (lpBuffer)
208+
lpBuffer[VarValue.Length / sizeof(WCHAR)] = UNICODE_NULL;
208209

209210
return (VarValue.Length / sizeof(WCHAR));
210211
}

0 commit comments

Comments
 (0)