aboutsummaryrefslogtreecommitdiffstats
path: root/src/html.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-03-02 21:44:02 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-03-02 21:44:02 +0300
commit0f2f88a6157250fecb9ce5d8d28b02b99739a2d2 (patch)
tree154d2efebe84ad274de17fef59756a4a46ff09fa /src/html.c
parent2d18269774d7541f3690973d568187c7e45448e5 (diff)
downloadrspamd-0f2f88a6157250fecb9ce5d8d28b02b99739a2d2.tar.gz
rspamd-0f2f88a6157250fecb9ce5d8d28b02b99739a2d2.zip
Try to fix memory issues.
Diffstat (limited to 'src/html.c')
-rw-r--r--src/html.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/html.c b/src/html.c
index 772f7d33b..2ab441ad3 100644
--- a/src/html.c
+++ b/src/html.c
@@ -679,14 +679,22 @@ html_strncasestr (const gchar *s, const gchar *find, gsize len)
}
static void
-check_phishing (struct worker_task *task, struct uri *href_url, const gchar *url_text)
+check_phishing (struct worker_task *task, struct uri *href_url, const gchar *url_text, gsize remain)
{
struct uri *new;
gchar *url_str;
- gsize len;
+ const gchar *p;
+ gsize len = 0;
gint off, rc;
- len = strcspn (url_text, "<>");
+ p = url_text;
+ while (len < remain) {
+ if (*p == '<' || *p == '>') {
+ break;
+ }
+ len ++;
+ p ++;
+ }
if (url_try_text (task->task_pool, url_text, len, &off, &url_str) && url_str != NULL) {
new = memory_pool_alloc0 (task->task_pool, sizeof (struct uri));
@@ -796,7 +804,7 @@ parse_tag_url (struct worker_task *task, struct mime_text_part *part, tag_id_t i
* Check for phishing
*/
if ((p = strchr (c, '>')) != NULL ) {
- check_phishing (task, url, p + 1);
+ check_phishing (task, url, p + 1, tag_len - (p - tag_text));
}
if (part->html_urls && g_tree_lookup (part->html_urls, url_text) == NULL) {
g_tree_insert (part->html_urls, url_text, url);