Alexandre Julliard : dbghelp: Fix handling of empty file regexp (Coverity).

Alexandre Julliard julliard at winehq.org
Mon Feb 9 10:29:50 CST 2009


Module: wine
Branch: master
Commit: 0f3445d6db7743a6707705f72dd7ff03bb860fea
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0f3445d6db7743a6707705f72dd7ff03bb860fea

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Feb  9 14:20:00 2009 +0100

dbghelp: Fix handling of empty file regexp (Coverity).

---

 dlls/dbghelp/symbol.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c
index 9e66f00..0810506 100644
--- a/dlls/dbghelp/symbol.c
+++ b/dlls/dbghelp/symbol.c
@@ -128,10 +128,11 @@ static BOOL compile_file_regex(regex_t* re, const char* srcfile)
     char *mask, *p;
     BOOL ret;
 
+    if (!srcfile || !*srcfile) return regcomp(re, ".*", REG_NOSUB);
+
     p = mask = HeapAlloc(GetProcessHeap(), 0, 5 * strlen(srcfile) + 4);
     *p++ = '^';
-    if (!srcfile || !*srcfile) *p++ = '*';
-    else while (*srcfile)
+    while (*srcfile)
     {
         switch (*srcfile)
         {
@@ -192,12 +193,14 @@ static void compile_regex(const char* str, int numchar, regex_t* re, BOOL _case)
 
 static BOOL compile_file_regex(regex_t* re, const char* srcfile)
 {
-    compile_regex( srcfile, -1, re, FALSE );
+    if (!srcfile || !*srcfile) re->str = NULL;
+    else compile_regex( srcfile, -1, re, FALSE );
     return TRUE;
 }
 
 static int match_regexp( const regex_t *re, const char *str )
 {
+    if (!re->str) return 1;
     if (re->icase) return !lstrcmpiA( re->str, str );
     return !strcmp( re->str, str );
 }




More information about the wine-cvs mailing list