diff options
author | Timo Teräs <timo.teras@iki.fi> | 2014-11-27 15:45:31 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2014-11-27 15:45:50 +0200 |
commit | bdb5a17e3570ee5bde564f894444125be16a233c (patch) | |
tree | 4d1a460ea120ec19ef0ca44b53417859bc2a10c2 | |
parent | bd36f7e1710fd429c80ef1814beb81db909c177d (diff) | |
download | squark-bdb5a17e3570ee5bde564f894444125be16a233c.tar.bz2 squark-bdb5a17e3570ee5bde564f894444125be16a233c.tar.xz |
filter: default path is const and thus non-writable
fix crash that would happen in blob_lowercase due to trying to
write rodata.
-rw-r--r-- | src/squark-filter.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/squark-filter.c b/src/squark-filter.c index 827540e..5ffcedf 100644 --- a/src/squark-filter.c +++ b/src/squark-filter.c @@ -168,8 +168,7 @@ static int url_parse(blob_t uri, struct url_info *nfo) else nfo->port = 80; } - if (blob_is_null(nfo->path)) - nfo->path = BLOB_STR("/"); + if (blob_is_null(nfo->path)) nfo->path = slash; /* significant host name */ nfo->significant_host = nfo->host; @@ -275,7 +274,7 @@ static int url_classify(struct url_info *url, struct sqdb *db) /* and then search for path matches -- construct hashing * string of url decoded path */ - blob_lowercase(url->path); /* filter DB stores all URLs in lowercase */ + if (url->path.ptr != slash.ptr) blob_lowercase(url->path); /* filter DB stores all URLs in lowercase */ blob_push_urldecode(&keybuf, url->path); keylimits = blob_pushed(BLOB_BUF(buffer), keybuf); |