diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-12 15:11:42 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-12 15:11:42 +0100 |
commit | 03bcabb80535bb9a3bc29d92c8eb26ed43262a98 (patch) | |
tree | 60a1b26444f31681e8001b2ebd25244012000345 /src/plugins/fuzzy_check.c | |
parent | 28f3a3e173bf5e34e0d95cf0e19d57f0a9fa70f3 (diff) | |
download | rspamd-03bcabb80535bb9a3bc29d92c8eb26ed43262a98.tar.gz rspamd-03bcabb80535bb9a3bc29d92c8eb26ed43262a98.zip |
Fix finding headers in HTTP messages.
Diffstat (limited to 'src/plugins/fuzzy_check.c')
-rw-r--r-- | src/plugins/fuzzy_check.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index af0aab420..f7a59522c 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -1292,7 +1292,7 @@ static gboolean fuzzy_controller_handler (struct rspamd_http_connection_entry *conn_ent, struct rspamd_http_message *msg, struct module_ctx *ctx, gint cmd) { - const gchar *arg; + const GString *arg; gchar *err_str; gint value = 1, flag = 0; @@ -1300,18 +1300,18 @@ fuzzy_controller_handler (struct rspamd_http_connection_entry *conn_ent, arg = rspamd_http_message_find_header (msg, "Weight"); if (arg) { errno = 0; - value = strtol (arg, &err_str, 10); - if (errno != 0 || *err_str != '\0') { - msg_info ("error converting numeric argument %s", arg); + value = strtol (arg->str, &err_str, 10); + if (*err_str != '\0' && *err_str != '\r') { + msg_info ("error converting numeric argument %v", arg); value = 0; } } arg = rspamd_http_message_find_header (msg, "Flag"); if (arg) { errno = 0; - flag = strtol (arg, &err_str, 10); - if (errno != 0 || *err_str != '\0') { - msg_info ("error converting numeric argument %s", arg); + flag = strtol (arg->str, &err_str, 10); + if (*err_str != '\0' && *err_str != '\r') { + msg_info ("error converting numeric argument %v", arg); flag = 0; } } |