[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.
This commit is contained in:
Carl J. Bialorucki
2026-01-09 08:54:58 -08:00
parent 02875dec22
commit c20ec94409
+2 -1
View File
@@ -204,7 +204,8 @@ GetEnvironmentVariableW(IN LPCWSTR lpName,
return 0;
}
lpBuffer[VarValue.Length / sizeof(WCHAR)] = UNICODE_NULL;
if (lpBuffer)
lpBuffer[VarValue.Length / sizeof(WCHAR)] = UNICODE_NULL;
return (VarValue.Length / sizeof(WCHAR));
}