From: Vsevolod Stakhov Date: Tue, 24 Apr 2018 13:53:59 +0000 (+0100) Subject: [Fix] Strip spaces from map keys and values X-Git-Tag: 1.7.4~46 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3281d1d77a53a6d905ef1aee0e0baf1096643283;p=rspamd.git [Fix] Strip spaces from map keys and values --- diff --git a/src/libutil/map_helpers.c b/src/libutil/map_helpers.c index 2cc2a1efa..dbbe70e84 100644 --- a/src/libutil/map_helpers.c +++ b/src/libutil/map_helpers.c @@ -76,14 +76,14 @@ struct rspamd_regexp_map_helper { 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); \ + key = g_strstrip (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_strchomp (value); \ + value = g_strstrip (value); \ } while (0) gchar * diff --git a/src/libutil/radix.c b/src/libutil/radix.c index 3ef471174..a42be7032 100644 --- a/src/libutil/radix.c +++ b/src/libutil/radix.c @@ -197,8 +197,9 @@ rspamd_radix_add_iplist (const gchar *list, const gchar *separators, cur++; continue; } + /* Extract ipnet */ - ipnet = *cur; + ipnet = g_strstrip (*cur); token = strsep (&ipnet, "/"); if (ipnet != NULL) {