From 2aeb35054e5ed990dd795e0f688be893bf16e243 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 27 Feb 2017 12:15:27 +0000 Subject: [PATCH] [Minor] Small improvements of key/value parsing of radix maps --- src/libutil/map.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libutil/map.c b/src/libutil/map.c index 72939aa7f..da99e384c 100644 --- a/src/libutil/map.c +++ b/src/libutil/map.c @@ -1723,14 +1723,17 @@ err: */ #define MAP_STORE_KEY do { \ + while (g_ascii_isspace (*c) && p > c) { c ++; } \ key = g_malloc (p - c + 1); \ rspamd_strlcpy (key, c, p - c + 1); \ + key = g_strchomp (key); \ } while (0) #define MAP_STORE_VALUE do { \ + while (g_ascii_isspace (*c) && p > c) { c ++; } \ value = g_malloc (p - c + 1); \ rspamd_strlcpy (value, c, p - c + 1); \ - value = g_strstrip (value); \ + value = g_strchomp (value); \ } while (0) gchar * @@ -2067,7 +2070,7 @@ radix_tree_insert_helper (gpointer st, gconstpointer key, gconstpointer value) { radix_compressed_t *tree = (radix_compressed_t *)st; - rspamd_radix_add_iplist ((gchar *)key, " ,;", tree, value, FALSE); + rspamd_radix_add_iplist ((gchar *)key, ",", tree, value, FALSE); } static void -- 2.39.5