From: Vsevolod Stakhov Date: Wed, 3 Nov 2010 14:21:12 +0000 (+0300) Subject: Urgent fixes. X-Git-Tag: 0.3.3~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e3d3e31606aa9a6635af0434797fc2fe842a6a6a;p=rspamd.git Urgent fixes. --- diff --git a/src/html.c b/src/html.c index 8bbea9548..dee38a86b 100644 --- a/src/html.c +++ b/src/html.c @@ -688,7 +688,7 @@ check_phishing (struct worker_task *task, struct uri *href_url, const gchar *url len = strcspn (url_text, "<>"); - if (url_try_text (task->task_pool, url_text, len, &off, &url_str)) { + 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)); if (new != NULL) { g_strstrip (url_str); diff --git a/src/url.c b/src/url.c index e801527bd..3b96c083e 100644 --- a/src/url.c +++ b/src/url.c @@ -1169,7 +1169,8 @@ url_parse_text (memory_pool_t * pool, struct worker_task *task, struct mime_text } while (p < end) { if (url_try_text (pool, p, end - p, &off, &url_str)) { - if (g_tree_lookup (is_html ? part->html_urls : part->urls, url_str) == NULL) { + if (url_str != NULL && + g_tree_lookup (is_html ? part->html_urls : part->urls, url_str) == NULL) { new = memory_pool_alloc0 (pool, sizeof (struct uri)); if (new != NULL) { g_strstrip (url_str); @@ -1215,6 +1216,9 @@ url_try_text (memory_pool_t *pool, const gchar *begin, gsize len, gint *res, gch (*url_str)[m.m_len] = '\0'; } + else { + *url_str = NULL; + } if (res) { *res = strlen (matcher->pattern); } diff --git a/src/util.c b/src/util.c index df0e444c3..eb1b77e0c 100644 --- a/src/util.c +++ b/src/util.c @@ -1551,7 +1551,7 @@ rspamd_sprintf_num (gchar *buf, gchar *last, guint64 ui64, gchar zero, return ((gchar *)memcpy (buf, p, len)) + len; } -#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MICRO_VERSION == 2) && (GLIB_MINOR_VERSION < 22)) +#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 22)) void g_ptr_array_unref (GPtrArray *array) { diff --git a/src/util.h b/src/util.h index de5df239a..f5ce840be 100644 --- a/src/util.h +++ b/src/util.h @@ -87,7 +87,7 @@ stat_file_t* get_statfile_by_symbol (statfile_pool_t *pool, struct classifier_co const gchar *symbol, struct statfile **st, gboolean try_create); #endif -#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MICRO_VERSION == 2) && (GLIB_MINOR_VERSION < 22)) +#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 22)) void g_ptr_array_unref (GPtrArray *array); #endif /*