[PATCH] uxtheme: Handle malformed keys a bit better (Coverity)

Marcus Meissner marcus at jet.franken.de
Mon Nov 23 02:59:14 CST 2009


This code might break if a ) is missed, so check for
NULL return from strchrW().

Ciao, Marcus
---
 dlls/uxtheme/msstyles.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/uxtheme/msstyles.c b/dlls/uxtheme/msstyles.c
index 825645d..896a294 100644
--- a/dlls/uxtheme/msstyles.c
+++ b/dlls/uxtheme/msstyles.c
@@ -364,7 +364,10 @@ static BOOL MSSTYLES_ParseIniSectionName(LPCWSTR lpSection, DWORD dwLen, LPWSTR
             lstrcpynW(part, comp, sizeof(part)/sizeof(part[0]));
             comp = tmp;
             /* now get the state */
-            *strchrW(comp, ')') = 0;
+            tmp = strchrW(comp, ')');
+            if (!tmp)
+                return FALSE;
+            *tmp = 0;
             lstrcpynW(state, comp, sizeof(state)/sizeof(state[0]));
         }
         else {
@@ -378,7 +381,10 @@ static BOOL MSSTYLES_ParseIniSectionName(LPCWSTR lpSection, DWORD dwLen, LPWSTR
             lstrcpynW(szClassName, comp, MAX_THEME_CLASS_NAME);
             comp = tmp;
             /* now get the state */
-            *strchrW(comp, ')') = 0;
+            tmp = strchrW(comp, ')');
+            if (!tmp)
+                return FALSE;
+            *tmp = 0;
             lstrcpynW(state, comp, sizeof(state)/sizeof(state[0]));
         }
         else {
-- 
1.5.6



More information about the wine-patches mailing list