diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-10-11 18:39:56 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-10-11 18:39:56 +0400 |
commit | dbee2f63ee747b5d4247038f27566bc5aebfe3b7 (patch) | |
tree | c2d60701691ab106e593be24a6974ab7dc0e6fa1 /src/plugins/surbl.c | |
parent | b0ce5fefb9e694083846af1e45b09f4baa4b0446 (diff) | |
download | rspamd-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/surbl.c')
-rw-r--r-- | src/plugins/surbl.c | 13 |
1 files changed, 11 insertions, 2 deletions
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 (¶m->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; |