diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-03-02 11:52:39 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-03-02 11:52:39 +0000 |
commit | 1389f72c3f595a725274cd02c2e8d1a6e79e1be9 (patch) | |
tree | 026bdb27fa01ef0830f104bf89ad766bf639483e /src/libserver/url.c | |
parent | 2f621fc77d005236a6772f7604e3b4555827c713 (diff) | |
download | rspamd-1389f72c3f595a725274cd02c2e8d1a6e79e1be9.tar.gz rspamd-1389f72c3f595a725274cd02c2e8d1a6e79e1be9.zip |
[Fix] Handle some bad IP URLs
Diffstat (limited to 'src/libserver/url.c')
-rw-r--r-- | src/libserver/url.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c index fcb72a76b..76306d9be 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -1184,7 +1184,12 @@ rspamd_url_is_ip (struct rspamd_url *uri, rspamd_mempool_t *pool) while (p <= end && check_num) { if (shift < 32 && ((*p == '.' && dots < 3) || (p == end && dots <= 3))) { - g_assert (p - c + 1 < (gint) sizeof (buf)); + if (p - c + 1 >= (gint) sizeof (buf)) { + msg_err_pool ("invalid numeric url %*.s...: too long", + INET6_ADDRSTRLEN, c); + return FALSE; + } + rspamd_strlcpy (buf, c, p - c + 1); c = p + 1; |