commit 8b74294: [Minor] Fix some corner cases in HTML parsing
Vsevolod Stakhov
vsevolod at highsecure.ru
Fri Oct 11 09:49:05 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-10-11 10:46:56 +0100
URL: https://github.com/rspamd/rspamd/commit/8b74294ece38dae6e2a05d79fceab80c8795513a (HEAD -> master)
[Minor] Fix some corner cases in HTML parsing
---
src/libserver/html.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
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);
More information about the Commits
mailing list