diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-04-07 22:47:46 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-04-07 22:47:46 +0100 |
commit | 6691508e4221b4efd89653f0a8ee49996446904e (patch) | |
tree | 47d836892b2b17031a7a47920aec5d87cb1bf051 /src | |
parent | 722c4939c0026cd0ff8110049468560fbb44d454 (diff) | |
download | rspamd-6691508e4221b4efd89653f0a8ee49996446904e.tar.gz rspamd-6691508e4221b4efd89653f0a8ee49996446904e.zip |
[Minor] Use proper substring search
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/html.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libserver/html.c b/src/libserver/html.c index abc795fa9..175398aa3 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -1605,6 +1605,7 @@ rspamd_html_process_img_tag (rspamd_mempool_t *pool, struct html_tag *tag, GList *cur; gulong val; gboolean seen_width = FALSE, seen_height = FALSE; + goffset pos; cur = tag->params->head; img = rspamd_mempool_alloc0 (pool, sizeof (*img)); @@ -1640,10 +1641,11 @@ rspamd_html_process_img_tag (rspamd_mempool_t *pool, struct html_tag *tag, else if (comp->type == RSPAMD_HTML_COMPONENT_STYLE) { /* Try to search for height= or width= in style tag */ if (!seen_height && comp->len > 0) { - p = rspamd_strncasestr (comp->start, "height", comp->len); + pos = rspamd_substring_search_caseless (comp->start, comp->len, + "height", sizeof ("height") - 1); - if (p != NULL) { - p += sizeof ("height") - 1; + if (pos != -1) { + p = comp->start + pos + sizeof ("height") - 1; while (p < comp->start + comp->len) { if (g_ascii_isdigit (*p)) { @@ -1661,10 +1663,11 @@ rspamd_html_process_img_tag (rspamd_mempool_t *pool, struct html_tag *tag, } if (!seen_width && comp->len > 0) { - p = rspamd_strncasestr (comp->start, "width", comp->len); + pos = rspamd_substring_search_caseless (comp->start, comp->len, + "width", sizeof ("width") - 1); - if (p != NULL) { - p += sizeof ("width") - 1; + if (pos != -1) { + p = comp->start + pos + sizeof ("width") - 1; while (p < comp->start + comp->len) { if (g_ascii_isdigit (*p)) { |