localui: [1/2] Avoid crash on NULL-Pointer

Detlef Riekenberg wine.dev at web.de
Mon Apr 23 17:05:47 CDT 2007


Native localui.dll does not crash, when the PortName is NULL


Changelog:
localui: [1/2] Avoid crash on NULL-Pointer


-- 
 
By by ... Detlef

-------------- next part --------------
>From 91493d13b9075a5e02366da5388b0151f0c79185 Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Mon, 23 Apr 2007 23:51:00 +0200
Subject: [PATCH] localui: Avoid crash on NULL-Pointer
---
 dlls/localui/localui.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/localui/localui.c b/dlls/localui/localui.c
index 36b2812..2fd61c3 100644
--- a/dlls/localui/localui.c
+++ b/dlls/localui/localui.c
@@ -50,11 +50,11 @@ static LPWSTR strdupWW(LPCWSTR pPrefix, 
     LPWSTR  ptr;
     DWORD   len;
 
-    len = lstrlenW(pPrefix) + lstrlenW(pSuffix) + 1;
+    len = lstrlenW(pPrefix) + (pSuffix ? lstrlenW(pSuffix) : 0) + 1;
     ptr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
     if (ptr) {
         lstrcpyW(ptr, pPrefix);
-        lstrcatW(ptr, pSuffix);
+        if (pSuffix) lstrcatW(ptr, pSuffix);
     }
     return ptr;
 }
-- 
1.4.1



More information about the wine-patches mailing list