From: Vsevolod Stakhov Date: Fri, 11 Oct 2019 09:46:56 +0000 (+0100) Subject: [Minor] Fix some corner cases in HTML parsing X-Git-Tag: 2.0~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8b74294ece38dae6e2a05d79fceab80c8795513a;p=rspamd.git [Minor] Fix some corner cases in HTML parsing --- diff --git a/src/libserver/html.c b/src/libserver/html.c index dbbefd10c..de6e104b4 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -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);