summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordominique.leuenberger@gmail.com <dominique.leuenberger@gmail.com@c587cffe-e639-0410-9787-d7902ae8ed56>2011-05-02 20:46:30 +0000
committerdominique.leuenberger@gmail.com <dominique.leuenberger@gmail.com@c587cffe-e639-0410-9787-d7902ae8ed56>2011-05-02 20:46:30 +0000
commit677c0fece98e268851fb0bce61703cafa62c1646 (patch)
tree509db6c023f1711c833c5422897346b03660533a
parent345df7493a44160d8bdb5710fd9ea5c5c990f0b4 (diff)
downloadlibproxy-677c0fece98e268851fb0bce61703cafa62c1646.tar.gz
Fix issue 161: in case host is one char longer than any of the domain ignore patterns, it is triggered as a ignore match.
git-svn-id: http://libproxy.googlecode.com/svn/trunk@805 c587cffe-e639-0410-9787-d7902ae8ed56
-rw-r--r--libproxy/modules/ignore_domain.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/libproxy/modules/ignore_domain.cpp b/libproxy/modules/ignore_domain.cpp
index 9183bb2..d031db1 100644
--- a/libproxy/modules/ignore_domain.cpp
+++ b/libproxy/modules/ignore_domain.cpp
@@ -18,6 +18,7 @@
******************************************************************************/
#include <cstdio>
+#include <iostream> // For cerr
#include "../extension_ignore.hpp"
using namespace libproxy;
@@ -44,11 +45,11 @@ public:
return (iport == 0 || port == iport);
/* Endswith (.domain.com or .domain.com:80) */
- if (ihost[0] == '.' && host.find(ihost) == host.size() - ihost.size())
+ if (ihost[0] == '.' && host.find(ihost) == host.size() - ihost.size() && host.size() >= ihost.size())
return (iport == 0 || port == iport);
/* Glob (*.domain.com or *.domain.com:80) */
- if (ihost[0] == '*' && host.find(ihost.substr(1)) == host.size() - ihost.substr(1).size())
+ if (ihost[0] == '*' && host.find(ihost.substr(1)) == host.size() - ihost.substr(1).size() && host.size() >= ihost.substr(1).size())
return (iport == 0 || port == iport);
/* No match was found */