diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_httpd.cpp | 2 | ||||
-rw-r--r-- | src/wildcard.cpp | 27 |
2 files changed, 20 insertions, 9 deletions
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 4b0177ef0..eff9a7ad2 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -193,7 +193,7 @@ class HttpServerSocket : public BufferedSocket date[strlen(date) - 1] = '\0'; rheaders.CreateHeader("Date", date); - rheaders.CreateHeader("Server", "InspIRCd/m_httpd.so/1.1"); + rheaders.CreateHeader("Server", "InspIRCd/m_httpd.so/1.2"); rheaders.SetHeader("Content-Length", ConvToStr(size)); if (size) diff --git a/src/wildcard.cpp b/src/wildcard.cpp index 3a91e8350..2df7a5bec 100644 --- a/src/wildcard.cpp +++ b/src/wildcard.cpp @@ -49,17 +49,19 @@ CoreExport bool csmatch(const std::string &str, const std::string &mask) while (string != str.end()) { - if (*wild == '*') + if (wild != mask.end() && *wild == '*') { if (++wild == mask.end()) return 1; mp = wild; cp = string; - cp++; + + if (cp != str.end()) + cp++; } else - if ((*wild == *string) || (*wild == '?')) + if ((string != str.end() && wild != mask.end()) && ((*wild == *string) || (*wild == '?'))) { wild++; string++; @@ -67,7 +69,10 @@ CoreExport bool csmatch(const std::string &str, const std::string &mask) else { wild = mp; - string = cp++; + if (cp == str.end()) + cp = str.end(); + else + string = cp++; } } @@ -98,17 +103,20 @@ CoreExport bool match(const std::string &str, const std::string &mask) while (string != str.end()) { - if (*wild == '*') + if (wild != mask.end() && *wild == '*') { if (++wild == mask.end()) return 1; mp = wild; cp = string; - cp++; + + if (cp != str.end()) + cp++; + } else - if ((lowermap[(unsigned char)*wild] == lowermap[(unsigned char)*string]) || (*wild == '?')) + if ((string != str.end() && wild != mask.end()) && ((lowermap[(unsigned char)*wild] == lowermap[(unsigned char)*string]) || (*wild == '?'))) { wild++; string++; @@ -116,7 +124,10 @@ CoreExport bool match(const std::string &str, const std::string &mask) else { wild = mp; - string = cp++; + if (cp == str.end()) + string = str.end(); + else + string = cp++; } } |