]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix some corner cases in HTML parsing
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 11 Oct 2019 09:46:56 +0000 (10:46 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 11 Oct 2019 09:46:56 +0000 (10:46 +0100)
src/libserver/html.c

index dbbefd10ce6012aa0b587b17c31cead7f115bec0..de6e104b4f9f718b74c782383ec455a767c6e948 100644 (file)
@@ -350,7 +350,7 @@ rspamd_html_decode_entitles_inplace (gchar *s, gsize len)
        khiter_t k;
 
        if (len == 0) {
-               l = strlen (s);
+               return 0;
        }
        else {
                l = len;
@@ -871,7 +871,10 @@ rspamd_html_parse_tag_component (rspamd_mempool_t *pool,
        gboolean ret = FALSE;
        gchar *p;
 
-       g_assert (end >= begin);
+       if (end <= begin) {
+               return FALSE;
+       }
+
        p = rspamd_mempool_alloc (pool, end - begin);
        memcpy (p, begin, end - begin);
        len = rspamd_html_decode_entitles_inplace (p, end - begin);