From 530d64a5a04a6becd0254c58124a5521c538c77e Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 1 Jul 2016 17:36:55 +0100 Subject: [PATCH] [Fix] Correctly parse query type --- src/controller.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/controller.c b/src/controller.c index bee46adce..78c168460 100644 --- a/src/controller.c +++ b/src/controller.c @@ -1081,16 +1081,16 @@ rspamd_controller_handle_graph ( return 0; } - if (strncmp (value->begin, "hourly", value->len) == 0) { + if (value->len == 6 && rspamd_lc_cmp (value->begin, "hourly", value->len) == 0) { rra_num = rra_hourly; } - else if (strncmp (value->begin, "daily", value->len) == 0) { - rra_num = rra_hourly; + else if (value->len == 5 && rspamd_lc_cmp (value->begin, "daily", value->len) == 0) { + rra_num = rra_daily; } - else if (strncmp (value->begin, "weekly", value->len) == 0) { - rra_num = rra_hourly; + else if (value->len == 6 && rspamd_lc_cmp (value->begin, "weekly", value->len) == 0) { + rra_num = rra_weekly; } - else if (strncmp (value->begin, "monthly", value->len) == 0) { + else if (value->len == 7 && rspamd_lc_cmp (value->begin, "monthly", value->len) == 0) { rra_num = rra_monthly; } -- 2.39.5