commit 4c68ce0: [Fix] Fix processing of embedded urls

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Apr 9 08:42:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-04-09 09:38:41 +0100
URL: https://github.com/rspamd/rspamd/commit/4c68ce08d71854ecdb1b67d5f603875eca4cc87e (HEAD -> master)

[Fix] Fix processing of embedded urls

---
 src/libserver/html.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/libserver/html.c b/src/libserver/html.c
index 41925609e..cc74d676e 100644
--- a/src/libserver/html.c
+++ b/src/libserver/html.c
@@ -1706,19 +1706,21 @@ rspamd_html_process_img_tag (rspamd_mempool_t *pool, struct html_tag *tag,
 				/* We have an embedded image */
 				img->flags |= RSPAMD_HTML_FLAG_IMAGE_EMBEDDED;
 			}
-			if (comp->len > sizeof ("data:") - 1 && memcmp (comp->start,
-					"data:", sizeof ("data:") - 1) == 0) {
-				/* We have an embedded image in HTML tag */
-				img->flags |=
-						(RSPAMD_HTML_FLAG_IMAGE_EMBEDDED|RSPAMD_HTML_FLAG_IMAGE_DATA);
-				rspamd_html_process_data_image (pool, img, comp);
-				hc->flags |= RSPAMD_HTML_FLAG_HAS_DATA_URLS;
-			}
 			else {
-				img->flags |= RSPAMD_HTML_FLAG_IMAGE_EXTERNAL;
-				if (img->src) {
-					img->url = rspamd_html_process_url (pool,
-							img->src, fstr.len, NULL);
+				if (comp->len > sizeof ("data:") - 1 && memcmp (comp->start,
+						"data:", sizeof ("data:") - 1) == 0) {
+					/* We have an embedded image in HTML tag */
+					img->flags |=
+							(RSPAMD_HTML_FLAG_IMAGE_EMBEDDED | RSPAMD_HTML_FLAG_IMAGE_DATA);
+					rspamd_html_process_data_image (pool, img, comp);
+					hc->flags |= RSPAMD_HTML_FLAG_HAS_DATA_URLS;
+				}
+				else {
+					img->flags |= RSPAMD_HTML_FLAG_IMAGE_EXTERNAL;
+					if (img->src) {
+						img->url = rspamd_html_process_url (pool,
+								img->src, fstr.len, NULL);
+					}
 				}
 			}
 		}


More information about the Commits mailing list