From: Amos Jeffries Date: Mon, 2 Mar 2009 10:10:46 +0000 (+1300) Subject: Author: Francesco Chemolli X-Git-Tag: SQUID_3_1_0_6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=23d36dbdc71f7eb62bfa02ee64a57c1e1200ec20;p=thirdparty%2Fsquid.git Author: Francesco Chemolli Fixed String search --- diff --git a/src/HttpHeaderTools.cc b/src/HttpHeaderTools.cc index 33ac3d5712..85c827ddee 100644 --- a/src/HttpHeaderTools.cc +++ b/src/HttpHeaderTools.cc @@ -189,7 +189,7 @@ int strListIsSubstr(const String * list, const char *s, char del) { assert(list && del); - return list->pos(s) != 0; + return (list->find(s) != String::npos); /** \note * Note: the original code with a loop is broken because it uses strstr() @@ -359,7 +359,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. diff --git a/src/String.cc b/src/String.cc index 90758326fe..a68af96883 100644 --- a/src/String.cc +++ b/src/String.cc @@ -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)); }