From: Vsevolod Stakhov Date: Tue, 9 Apr 2019 08:38:41 +0000 (+0100) Subject: [Fix] Fix processing of embedded urls X-Git-Tag: 1.9.2~52 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4c68ce08d71854ecdb1b67d5f603875eca4cc87e;p=rspamd.git [Fix] Fix processing of embedded urls --- 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); + } } } }