From: Thomas Faber Date: Sun, 3 Apr 2016 20:48:51 +0000 (+0000) Subject: [KERNEL32] X-Git-Tag: ReactOS-0.4.1~127 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=8a7494dd089d6e6b80eaae11869d32125ff23503;hp=d7414810357e968eefb008884d545a05718b854e [KERNEL32] - Correctly calculate the buffer size if the PATH variable is set but empty in BasepComputeProcessPath. Yes, this is a bug in Windows. CORE-11080 #resolve svn path=/trunk/; revision=71097 --- diff --git a/reactos/dll/win32/kernel32/client/path.c b/reactos/dll/win32/kernel32/client/path.c index 21415a5e821..dc3b044f342 100644 --- a/reactos/dll/win32/kernel32/client/path.c +++ b/reactos/dll/win32/kernel32/client/path.c @@ -210,9 +210,13 @@ BasepComputeProcessPath(IN PBASE_SEARCH_PATH_TYPE PathOrder, } else { - /* Add the length of the PATH variable */ + /* Add the length of the PATH variable unless it's empty */ ASSERT(!(EnvPath.Length & 1)); - PathLengthInBytes += (EnvPath.Length + sizeof(L';')); + if (EnvPath.Length) + { + /* Reserve space for the variable and a semicolon */ + PathLengthInBytes += (EnvPath.Length + sizeof(L';')); + } } break;