[CVE-2021-3518] Fix user-after-free with `xmllint --xinclude --dropdtd` 02/286702/1 accepted/tizen/6.0/base/tool/20230116.011835 submit/tizen_6.0_base/20230112.235350
authorNick Wellnhofer <wellnhofer@aevum.de>
Thu, 22 Apr 2021 17:26:28 +0000 (19:26 +0200)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 12 Jan 2023 01:31:09 +0000 (10:31 +0900)
commit9daf701ad6e4f2d60a18341ff790b361406d59c3
tree2b5d63fc90f20110e054fbcd1a0a83427d7cce43
parentfce558e02dbb280cebfc492297ed63dfc9bdf922
[CVE-2021-3518] Fix user-after-free with `xmllint --xinclude --dropdtd`

The --dropdtd option can leave dangling pointers in entity reference
nodes. Make sure to skip these nodes when processing XIncludes.

This also avoids scanning entity declarations and even modifying
them inadvertently during XInclude processing.

Move from a block list to an allow list approach to avoid descending
into other node types that can't contain elements.

Fixes #237.

Change-Id: Ifd6eee2ade87d55469e234066186921b83fe4dd6
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
xinclude.c