]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added guards against undefnined Strings in the pos()family.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Sun, 1 Mar 2009 22:19:44 +0000 (23:19 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Sun, 1 Mar 2009 22:19:44 +0000 (23:19 +0100)
src/HttpHeaderTools.cc
src/String.cc

index 33ac3d5712667cb5f4ceb503d1e75ba5dc786567..24b285076d8ead1e99ac344289f220e20ea8fade 100644 (file)
@@ -189,7 +189,6 @@ int
 strListIsSubstr(const String * list, const char *s, char del)
 {
     assert(list && del);
-    return list->pos(s) != 0;
 
     /** \note
      * Note: the original code with a loop is broken because it uses strstr()
@@ -359,7 +358,7 @@ httpHeaderParseQuotedString (const char *start, String *val)
 
 /**
  * Checks the anonymizer (header_access) configuration.
- * 
+ *
  * \retval 0    Header is explicitly blocked for removal
  * \retval 1    Header is explicitly allowed
  * \retval 1    Header has been replaced, the current version can be used.
index 90758326fed739a29090b9a2494333625da36493..a68af96883678c127e4e1f1c6ec002c5c932b6ec 100644 (file)
@@ -437,18 +437,24 @@ checkNullString(const char *p)
 const char *
 String::pos(char const *aString) const
 {
+    if (undefined())
+        return NULL;
     return strstr(termedBuf(), aString);
 }
 
 const char *
 String::pos(char const ch) const
 {
+    if (undefined())
+        return NULL;
     return strchr(termedBuf(), ch);
 }
 
 const char *
 String::rpos(char const ch) const
 {
+    if (undefined())
+        return NULL;
     return strrchr(termedBuf(), (ch));
 }