From: Vsevolod Stakhov Date: Mon, 27 Feb 2017 12:15:27 +0000 (+0000) Subject: [Minor] Small improvements of key/value parsing of radix maps X-Git-Tag: 1.5.0~28 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2aeb35054e5ed990dd795e0f688be893bf16e243;p=rspamd.git [Minor] Small improvements of key/value parsing of radix maps --- 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