[PATCH] handle potential NULL ptr problem

Marcus Meissner marcus at jet.franken.de
Fri Jan 11 02:21:53 CST 2008


Hi,

Coverity spotted those, the ptr is later
on dereferenced if len is not 0.

Ciao, Marcus
---
 dlls/imm32/imm.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
index 4acbde3..0293bc7 100644
--- a/dlls/imm32/imm.c
+++ b/dlls/imm32/imm.c
@@ -243,6 +243,9 @@ static HIMCC updateCompStr(HIMCC old, LPWSTR compstr, DWORD len)
     if (old == NULL && compstr == NULL && len == 0)
         return NULL;
 
+    if ((compstr == NULL) && (len>0))
+	return NULL;
+
     if (old != NULL)
     {
         olddata = ImmLockIMCC(old);
@@ -379,6 +382,9 @@ static HIMCC updateResultStr(HIMCC old, LPWSTR resultstr, DWORD len)
     if (old == NULL && resultstr == NULL && len == 0)
         return NULL;
 
+    if ((resultstr == NULL) && (len>0))
+	return NULL;
+
     if (old != NULL)
     {
         olddata = ImmLockIMCC(old);
-- 
1.5.2.4



More information about the wine-patches mailing list