aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-03-05 19:29:41 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-03-05 19:29:41 +0300
commit5b4b47c6c4d81d0ca082617293d7284396998e0d (patch)
treeb01b1921f1941d042996931144f7f51b2464b21d /src
parent7487d02f1b3224a913e66d9940adcdaf9c966e7d (diff)
downloadrspamd-5b4b47c6c4d81d0ca082617293d7284396998e0d.tar.gz
rspamd-5b4b47c6c4d81d0ca082617293d7284396998e0d.zip
Fix memory access.
Diffstat (limited to 'src')
-rw-r--r--src/plugins/regexp.c2
-rw-r--r--src/worker.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c
index 0ab4451e1..24d238d81 100644
--- a/src/plugins/regexp.c
+++ b/src/plugins/regexp.c
@@ -908,7 +908,7 @@ process_regexp (struct rspamd_regexp *re, struct worker_task *task, const gchar
debug_task ("found header \"%s\" with value \"%s\"", re->header, (const gchar *)cur->data);
rh = cur->data;
/* Try to match regexp */
- if (g_regex_match_full (re->regexp, rh->value, -1, 0, 0, NULL, &err) == TRUE) {
+ if (rh->value && g_regex_match_full (re->regexp, rh->value, -1, 0, 0, NULL, &err) == TRUE) {
if (G_UNLIKELY (re->is_test)) {
msg_info ("process test regexp %s for header %s with value '%s' returned TRUE", re->regexp_text, re->header, (const gchar *)cur->data);
}
diff --git a/src/worker.c b/src/worker.c
index 738002209..8f1177326 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -465,12 +465,12 @@ compare_email_func (gconstpointer a, gconstpointer b)
const struct uri *u1 = a, *u2 = b;
gint r;
- if (u1->hostlen != u2->hostlen) {
+ if (u1->hostlen != u2->hostlen || u1->hostlen == 0) {
return u1->hostlen - u2->hostlen;
}
else {
if ((r = g_ascii_strncasecmp (u1->host, u2->host, u1->hostlen)) == 0){
- if (u1->userlen != u2->userlen) {
+ if (u1->userlen != u2->userlen || u1->userlen == 0) {
return u1->userlen - u2->userlen;
}
else {
@@ -491,7 +491,7 @@ compare_url_func (gconstpointer a, gconstpointer b)
const struct uri *u1 = a, *u2 = b;
int r;
- if (u1->hostlen != u2->hostlen) {
+ if (u1->hostlen != u2->hostlen || u1->hostlen == 0) {
return u1->hostlen - u2->hostlen;
}
else {