]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Stop polluting logs on garbadge urls
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 18 Apr 2021 19:40:38 +0000 (20:40 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 18 Apr 2021 19:40:38 +0000 (20:40 +0100)
Issue: #3688

src/libserver/url.c

index a97db640a75cb1130e0eee31d3a61f407266f18d..6f62702b3a0acc6b7f07218d2b8561251b97f09f 100644 (file)
@@ -1803,7 +1803,7 @@ rspamd_url_is_ip (struct rspamd_url *uri, rspamd_mempool_t *pool)
                end--;
        }
 
-       if (end - p == 0) {
+       if (end - p == 0 || end - p > INET6_ADDRSTRLEN) {
                return FALSE;
        }
 
@@ -1832,7 +1832,7 @@ rspamd_url_is_ip (struct rspamd_url *uri, rspamd_mempool_t *pool)
                        if (shift < 32 &&
                                ((*p == '.' && dots < 3) || (p == end && dots <= 3))) {
                                if (p - c + 1 >= (gint) sizeof (buf)) {
-                                       msg_err_pool ("invalid numeric url %*.s...: too long",
+                                       msg_debug_pool ("invalid numeric url %*.s...: too long",
                                                        INET6_ADDRSTRLEN, c);
                                        return FALSE;
                                }