summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-10-11 18:39:56 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-10-11 18:39:56 +0400
commitdbee2f63ee747b5d4247038f27566bc5aebfe3b7 (patch)
treec2d60701691ab106e593be24a6974ab7dc0e6fa1 /src/plugins
parentb0ce5fefb9e694083846af1e45b09f4baa4b0446 (diff)
downloadrspamd-dbee2f63ee747b5d4247038f27566bc5aebfe3b7.tar.gz
rspamd-dbee2f63ee747b5d4247038f27566bc5aebfe3b7.zip
Fixes bugs found with clang-static analyser.
Strictly follow c99 standart. Turn on pedantic c99 checks.
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/custom/ipmark/CMakeLists.txt2
-rw-r--r--src/plugins/regexp.c2
-rw-r--r--src/plugins/surbl.c13
3 files changed, 13 insertions, 4 deletions
diff --git a/src/plugins/custom/ipmark/CMakeLists.txt b/src/plugins/custom/ipmark/CMakeLists.txt
index 1c1b1e64c..42785599b 100644
--- a/src/plugins/custom/ipmark/CMakeLists.txt
+++ b/src/plugins/custom/ipmark/CMakeLists.txt
@@ -4,7 +4,7 @@ SET(IPMARKSRC ipmark.c
../../../mem_pool.c
)
-ADD_LIBRARY(rspamd_ipmark MODULE ${IPMARKSRC})
+ADD_LIBRARY(rspamd_ipmark SHARED ${IPMARKSRC})
TARGET_LINK_LIBRARIES(rspamd_ipmark ${GLIB2_LIBRARIES})
INSTALL(TARGETS rspamd_ipmark DESTINATION lib)
diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c
index 32ab2b58c..c70b5d232 100644
--- a/src/plugins/regexp.c
+++ b/src/plugins/regexp.c
@@ -1213,7 +1213,7 @@ rspamd_check_smtp_data (struct worker_task *task, GList * args, void *unused)
}
}
}
- else {
+ else if (arg != NULL) {
if (what != NULL) {
if (process_regexp_expression (arg->data, "regexp_check_smtp_data", task, what)) {
return TRUE;
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c
index 71fbbd55d..452b590d5 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -511,7 +511,7 @@ format_surbl_request (memory_pool_t * pool, f_str_t * hostname, struct suffix_it
if (append_suffix) {
- r += rspamd_snprintf (result + r, len - r, ".%s", suffix->suffix);
+ rspamd_snprintf (result + r, len - r, ".%s", suffix->suffix);
}
msg_debug ("request: %s, dots: %d, level: %d, orig: %*s", result, dots_num, level, (gint)hostname->len, hostname->begin);
@@ -797,7 +797,16 @@ redirector_callback (gint fd, short what, void *arg)
break;
case STATE_READ:
if (what == EV_READ) {
- r = read (param->sock, url_buf, sizeof (url_buf));
+ r = read (param->sock, url_buf, sizeof (url_buf) - 1);
+ if (r <= 0) {
+ msg_err ("read failed: %s from %s", strerror (errno), param->redirector->name);
+ remove_normal_event (param->task->s, free_redirector_session, param);
+ upstream_fail (&param->redirector->up, param->task->tv.tv_sec);
+ return;
+ }
+
+ url_buf[r - 1] = '\0';
+
if ((p = strstr (url_buf, "Uri: ")) != NULL) {
p += sizeof ("Uri: ") - 1;
c = p;