mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-04-01 10:50:08 +03:00
tree: Fix recursion check in xmlStringGetNodeList
Use the new entity flag to check for recursion.
This commit is contained in:
parent
d320a683d1
commit
e6401b68df
22
tree.c
22
tree.c
@ -1412,14 +1412,19 @@ xmlStringLenGetNodeList(const xmlDoc *doc, const xmlChar *value, int len) {
|
||||
goto out;
|
||||
}
|
||||
else if ((ent != NULL) &&
|
||||
((ent->flags & XML_ENT_PARSED) == 0)) {
|
||||
((ent->flags & XML_ENT_PARSED) == 0) &&
|
||||
((ent->flags & XML_ENT_EXPANDING) == 0)) {
|
||||
xmlNodePtr temp;
|
||||
|
||||
/* Set to non-NULL value to avoid recursion. */
|
||||
ent->children = (xmlNodePtr) -1;
|
||||
/*
|
||||
* The entity should have been checked already,
|
||||
* but set the flag anyway to avoid recursion.
|
||||
*/
|
||||
ent->flags |= XML_ENT_EXPANDING;
|
||||
ent->children = xmlStringGetNodeList(doc,
|
||||
(const xmlChar*)node->content);
|
||||
ent->owner = 1;
|
||||
ent->flags &= ~XML_ENT_EXPANDING;
|
||||
ent->flags |= XML_ENT_PARSED;
|
||||
temp = ent->children;
|
||||
while (temp) {
|
||||
@ -1610,14 +1615,19 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
|
||||
if (node == NULL)
|
||||
goto out;
|
||||
if ((ent != NULL) &&
|
||||
((ent->flags & XML_ENT_PARSED) == 0)) {
|
||||
((ent->flags & XML_ENT_PARSED) == 0) &&
|
||||
((ent->flags & XML_ENT_EXPANDING) == 0)) {
|
||||
xmlNodePtr temp;
|
||||
|
||||
/* Set to non-NULL value to avoid recursion. */
|
||||
ent->children = (xmlNodePtr) -1;
|
||||
/*
|
||||
* The entity should have been checked already,
|
||||
* but set the flag anyway to avoid recursion.
|
||||
*/
|
||||
ent->flags |= XML_ENT_EXPANDING;
|
||||
ent->children = xmlStringGetNodeList(doc,
|
||||
(const xmlChar*)node->content);
|
||||
ent->owner = 1;
|
||||
ent->flags &= ~XML_ENT_EXPANDING;
|
||||
ent->flags |= XML_ENT_PARSED;
|
||||
temp = ent->children;
|
||||
while (temp) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user