[RTL]
authorThomas Faber <thomas.faber@reactos.org>
Thu, 19 Nov 2015 16:03:21 +0000 (16:03 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Thu, 19 Nov 2015 16:03:21 +0000 (16:03 +0000)
- Acquire the PEB lock before reading Peb->ProcessParameters->Environment in RtlQueryEnvironmentVariable_U. Patch by Mark Jansen.
CORE-10381

svn path=/trunk/; revision=69939

reactos/lib/rtl/env.c

index 2135c5a..2db9755 100644 (file)
@@ -524,6 +524,7 @@ RtlQueryEnvironmentVariable_U(PWSTR Environment,
    {
       PPEB Peb = RtlGetCurrentPeb();
       if (Peb) {
+          RtlAcquirePebLock();
           Environment = Peb->ProcessParameters->Environment;
           SysEnvUsed = TRUE;
       }
@@ -531,12 +532,12 @@ RtlQueryEnvironmentVariable_U(PWSTR Environment,
 
    if (Environment == NULL)
    {
+      if (SysEnvUsed)
+         RtlReleasePebLock();
       return(STATUS_VARIABLE_NOT_FOUND);
    }
 
    Value->Length = 0;
-   if (SysEnvUsed)
-      RtlAcquirePebLock();
 
    wcs = Environment;
    DPRINT("Starting search at :%p\n", wcs);