summaryrefslogtreecommitdiffstats
path: root/src/squark-filter.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-11-12 15:51:09 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-11-12 15:51:09 +0200
commit28d71e825f122379feaa0a5231c72719dbbe459a (patch)
tree704699bf4aa98c52ca18a2fee150296383ca2673 /src/squark-filter.c
parentc17f12b2ee059aa2c78f25bb0f97e2cfe93dde8f (diff)
downloadsquark-28d71e825f122379feaa0a5231c72719dbbe459a.tar.bz2
squark-28d71e825f122379feaa0a5231c72719dbbe459a.tar.xz
squark-filter: fix path component lookup
Do not do string literal lookup unless the path parent matches. This avoids wrong string literal lookups when the path does not exist and refers actuall to an entry which is IPv4 encoded (parent == SQDB_PARENT_IPV4).
Diffstat (limited to 'src/squark-filter.c')
-rw-r--r--src/squark-filter.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/squark-filter.c b/src/squark-filter.c
index c8e4f18..50b96de 100644
--- a/src/squark-filter.c
+++ b/src/squark-filter.c
@@ -294,8 +294,8 @@ static int url_classify(struct url_info *url, struct sqdb *db)
previ = i;
i = cmph_search_packed(cmph, key.ptr, key.len);
- tld = sqdb_get_string_literal(db, indx[i].component);
- if (blob_cmp(got, sqdb_get_string_literal(db, indx[i].component)) != 0) {
+ if (indx[i].parent != previ ||
+ blob_cmp(got, sqdb_get_string_literal(db, indx[i].component)) != 0) {
/* the subdomain did no longer match, use
* parents classification */
i = previ;