225dfd4b205b8bf084ade9079c010b5d6fffbf45
angie
  Tue Oct 23 10:19:47 2012 -0700
If regexMatch is called on NULL string, return FALSE (instead of possible segv).
diff --git src/lib/regexHelper.c src/lib/regexHelper.c
index 9c9e340..b617c2c 100644
--- src/lib/regexHelper.c
+++ src/lib/regexHelper.c
@@ -29,30 +29,32 @@
 	regerror(errNum, compiledExp, errBuf, sizeof(errBuf));
 	errAbort("%s \"%s\" got regular expression compilation error %d:\n%s\n",
 		 description, exp, errNum, errBuf);
 	}
     hashAdd(reHash, key, compiledExp);
     return(compiledExp);
     }
 }
 
 static boolean regexMatchSubstrMaybeCase(const char *string, const char *exp,
 					 regmatch_t substrArr[], size_t substrArrSize,
 					 boolean isCaseInsensitive)
 /* Return TRUE if string matches regular expression exp;
  * regexec fills in substrArr with substring offsets. */
 {
+if (string == NULL)
+    return FALSE;
 int compileFlags = REG_EXTENDED;
 char desc[256];
 safecpy(desc, sizeof(desc), "Regular expression");
 if (isCaseInsensitive)
     {
     compileFlags |= REG_ICASE;
     safecat(desc, sizeof(desc), " (case insensitive)");
     }
 if (substrArr == NULL)
     compileFlags |= REG_NOSUB;
 else
     safecat(desc, sizeof(desc), " with substrings");
 
 const regex_t *compiledExp = regexCompile(exp, desc, compileFlags);
 return(regexec(compiledExp, string, substrArrSize, substrArr, 0) == 0);