aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/html.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-17 16:11:31 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-17 16:12:42 +0000
commit28b5ce29ad59b6ba104c7ee5f9657d403272a6dd (patch)
treea799b32661abab7d9b0152d7beb2f0358d25b025 /src/libserver/html.c
parent6f4c81800686e7f529e474ea1b77ee51f5ca3372 (diff)
downloadrspamd-28b5ce29ad59b6ba104c7ee5f9657d403272a6dd.tar.gz
rspamd-28b5ce29ad59b6ba104c7ee5f9657d403272a6dd.zip
Fix processing of HTML tags.
Diffstat (limited to 'src/libserver/html.c')
-rw-r--r--src/libserver/html.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/libserver/html.c b/src/libserver/html.c
index 248e57bf5..2d1896d84 100644
--- a/src/libserver/html.c
+++ b/src/libserver/html.c
@@ -895,12 +895,6 @@ rspamd_html_process_tag (rspamd_mempool_t *pool, struct html_content *hc,
/* Block tag */
nnode = g_node_new (tag);
- if (tag->params) {
- rspamd_mempool_add_destructor (pool,
- (rspamd_mempool_destruct_t) g_list_free,
- tag->params);
- }
-
if (tag->flags & FL_CLOSING) {
if (!*cur_level) {
msg_debug_pool ("bad parent node");
@@ -961,7 +955,7 @@ rspamd_html_process_tag (rspamd_mempool_t *pool, struct html_content *hc,
comp->type = (comp_type); \
comp->start = NULL; \
comp->len = 0; \
- tag->params = g_list_append (tag->params, comp); \
+ g_queue_push_tail (tag->params, comp); \
ret = TRUE; \
} while(0)
@@ -1217,7 +1211,8 @@ rspamd_html_parse_tag_content (rspamd_mempool_t *pool,
if (store) {
if (*savep != NULL) {
g_assert (tag->params != NULL);
- comp = (g_list_first (tag->params))->data;
+ comp = g_queue_peek_tail (tag->params);
+ g_assert (comp != NULL);
comp->len = in - *savep;
comp->start = *savep;
*savep = NULL;
@@ -1233,7 +1228,8 @@ rspamd_html_parse_tag_content (rspamd_mempool_t *pool,
if (store) {
if (*savep != NULL) {
g_assert (tag->params != NULL);
- comp = (g_list_first (tag->params))->data;
+ comp = g_queue_peek_tail (tag->params);
+ g_assert (comp != NULL);
comp->len = in - *savep;
comp->start = *savep;
*savep = NULL;
@@ -1252,7 +1248,8 @@ rspamd_html_parse_tag_content (rspamd_mempool_t *pool,
if (store) {
if (*savep != NULL) {
g_assert (tag->params != NULL);
- comp = (g_list_first (tag->params))->data;
+ comp = g_queue_peek_tail (tag->params);
+ g_assert (comp != NULL);
comp->len = in - *savep;
comp->start = *savep;
*savep = NULL;
@@ -1289,7 +1286,7 @@ rspamd_html_process_url_tag (rspamd_mempool_t *pool, struct html_tag *tag)
GList *cur;
gint rc;
- cur = tag->params;
+ cur = tag->params->head;
while (cur) {
comp = cur->data;
@@ -1356,7 +1353,7 @@ rspamd_html_process_img_tag (rspamd_mempool_t *pool, struct html_tag *tag,
GList *cur;
gulong val;
- cur = tag->params;
+ cur = tag->params->head;
img = rspamd_mempool_alloc0 (pool, sizeof (*img));
while (cur) {
@@ -1563,7 +1560,7 @@ rspamd_html_process_block_tag (rspamd_mempool_t *pool, struct html_tag *tag,
rspamd_ftok_t fstr;
GList *cur;
- cur = tag->params;
+ cur = tag->params->head;
bl = rspamd_mempool_alloc0 (pool, sizeof (*bl));
bl->tag = tag;
@@ -1708,6 +1705,9 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc,
substate = 0;
savep = NULL;
cur_tag = rspamd_mempool_alloc0 (pool, sizeof (*cur_tag));
+ cur_tag->params = g_queue_new ();
+ rspamd_mempool_add_destructor (pool,
+ (rspamd_mempool_destruct_t)g_queue_free, cur_tag->params);
break;
}