From fb0811a01f73d5d15c63c4fe85e786d0e2893920 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sat, 14 Sep 2013 09:12:12 +0000 Subject: [PATCH] [KERNEL32] - Fix an off-by-one in the UNC case in WaitNamedPipeW - Some readability svn path=/trunk/; revision=60093 --- reactos/dll/win32/kernel32/client/file/npipe.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/kernel32/client/file/npipe.c b/reactos/dll/win32/kernel32/client/file/npipe.c index 9345333aa5e..82ac4b5ea9c 100644 --- a/reactos/dll/win32/kernel32/client/file/npipe.c +++ b/reactos/dll/win32/kernel32/client/file/npipe.c @@ -415,8 +415,9 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, } /* Move past it */ - NewName.Buffer += 9; - NewName.Length -= 9 * sizeof(WCHAR); + NewName.Buffer += PipePrefix.Length / sizeof(WCHAR); + NewName.Length -= PipePrefix.Length; + NewName.MaximumLength -= PipePrefix.Length; /* Initialize the Dos Devices name */ TRACE("NewName: %wZ\n", &NewName); @@ -438,10 +439,10 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, } while (*p); /* Now make sure the full name contains "pipe\" */ - if ((*p) && !(_wcsnicmp(p + 1, L"pipe\\", sizeof("pipe\\")))) + if ((*p) && !(_wcsnicmp(p + 1, L"pipe\\", sizeof("pipe\\") - sizeof(ANSI_NULL)))) { /* Get to the pipe name itself now */ - p += sizeof("pipe\\") - 1; + p += sizeof("pipe\\") - sizeof(ANSI_NULL); } else {