From 3832f83a32040e17c195513f5671ecec2387e6b0 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Mon, 23 Oct 2017 13:39:44 +0200 Subject: [PATCH] [KERNEL32] Check Basep8BitStringToDynamicUnicodeString() return and only call -W in case of success CID 1419330 --- dll/win32/kernel32/client/file/npipe.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dll/win32/kernel32/client/file/npipe.c b/dll/win32/kernel32/client/file/npipe.c index 535f648e59a..ee341580c25 100644 --- a/dll/win32/kernel32/client/file/npipe.c +++ b/dll/win32/kernel32/client/file/npipe.c @@ -344,17 +344,18 @@ WINAPI WaitNamedPipeA(LPCSTR lpNamedPipeName, DWORD nTimeOut) { - BOOL r; + BOOL r = FALSE; UNICODE_STRING NameU; /* Convert the name to Unicode */ - Basep8BitStringToDynamicUnicodeString(&NameU, lpNamedPipeName); + if (Basep8BitStringToDynamicUnicodeString(&NameU, lpNamedPipeName)) + { + /* Call the Unicode API */ + r = WaitNamedPipeW(NameU.Buffer, nTimeOut); - /* Call the Unicode API */ - r = WaitNamedPipeW(NameU.Buffer, nTimeOut); - - /* Free the Unicode string */ - RtlFreeUnicodeString(&NameU); + /* Free the Unicode string */ + RtlFreeUnicodeString(&NameU); + } /* Return result */ return r;