commit 3d0dd27: [CritFix] Fix html entities decoding

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Feb 3 17:21:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-02-03 17:17:06 +0000
URL: https://github.com/rspamd/rspamd/commit/3d0dd27030df359f17181c5f926fb500c119a962

[CritFix] Fix html entities decoding

---
 src/libserver/html.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libserver/html.c b/src/libserver/html.c
index 395987cce..668d1bdff 100644
--- a/src/libserver/html.c
+++ b/src/libserver/html.c
@@ -506,7 +506,7 @@ rspamd_html_decode_entitles_inplace (gchar *s, gsize len)
 	/* Leftover */
 	if (state == 1 && h > e) {
 		/* Unfinished entity, copy as is */
-		if (end - t > h - e) {
+		if (end - t >= h - e) {
 			memmove (t, e, h - e);
 			t += h - e;
 		}
@@ -1511,7 +1511,7 @@ rspamd_html_process_url_tag (rspamd_mempool_t *pool, struct html_tag *tag,
 					orig_len = len;
 					len += hc->base_url->urllen;
 
-					if (hc->base_url->string[hc->base_url->urllen - 1] != '/') {
+					if (hc->base_url->datalen == 0) {
 						need_slash = TRUE;
 						len ++;
 					}


More information about the Commits mailing list