aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-11-19 10:49:54 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-11-19 10:49:54 +0000
commit5aac0be13a65b396fd1c62ff95fb8657cc109a32 (patch)
treefc9a27923fd789a559d09def26d2fcfc41b30eba /src/libserver
parent40101edb0e09137b69f3dad467b3816f0bbdecab (diff)
downloadrspamd-5aac0be13a65b396fd1c62ff95fb8657cc109a32.tar.gz
rspamd-5aac0be13a65b396fd1c62ff95fb8657cc109a32.zip
[Minor] Add safe-guard for the root tag
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/html/html.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx
index 5260ba690..a920f9a4f 100644
--- a/src/libserver/html/html.cxx
+++ b/src/libserver/html/html.cxx
@@ -1400,18 +1400,20 @@ html_process_input(rspamd_mempool_t *pool,
}
if (pt) {
+ g_assert(cur_tag != pt);
cur_tag->parent = pt;
- g_assert(cur_tag->parent != cur_tag);
g_assert(cur_tag->parent != &cur_closing_tag);
parent_tag = pt;
parent_tag->children.push_back(cur_tag);
}
else {
if (hc->root_tag) {
- cur_tag->parent = hc->root_tag;
- g_assert(cur_tag->parent != cur_tag);
- hc->root_tag->children.push_back(cur_tag);
- parent_tag = hc->root_tag;
+ if (cur_tag != hc->root_tag) {
+ cur_tag->parent = hc->root_tag;
+ g_assert(cur_tag->parent != cur_tag);
+ hc->root_tag->children.push_back(cur_tag);
+ parent_tag = hc->root_tag;
+ }
}
else {
if (cur_tag->id == Tag_HTML) {