mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2026-01-26 21:41:34 +03:00
catalog: Ignore repeated nextCatalog entries
This patch makes the catalog parsing to ignore repeated entries of nextCatalog with the same value. Fix https://gitlab.gnome.org/GNOME/libxml2/-/issues/1019
This commit is contained in:
committed by
Daniel Garcia Moreno
parent
1961208e95
commit
f75abfcaa4
18
catalog.c
18
catalog.c
@@ -1223,9 +1223,27 @@ xmlParseXMLCatalogNode(xmlNodePtr cur, xmlCatalogPrefer prefer,
|
||||
BAD_CAST "delegateURI", BAD_CAST "uriStartString",
|
||||
BAD_CAST "catalog", prefer, cgroup);
|
||||
} else if (xmlStrEqual(cur->name, BAD_CAST "nextCatalog")) {
|
||||
xmlCatalogEntryPtr prev = parent->children;
|
||||
|
||||
entry = xmlParseXMLCatalogOneNode(cur, XML_CATA_NEXT_CATALOG,
|
||||
BAD_CAST "nextCatalog", NULL,
|
||||
BAD_CAST "catalog", prefer, cgroup);
|
||||
/* Avoid duplication of nextCatalog */
|
||||
while (prev != NULL) {
|
||||
if ((prev->type == XML_CATA_NEXT_CATALOG) &&
|
||||
(xmlStrEqual (prev->URL, entry->URL)) &&
|
||||
(xmlStrEqual (prev->value, entry->value)) &&
|
||||
(prev->prefer == entry->prefer) &&
|
||||
(prev->group == entry->group)) {
|
||||
if (xmlDebugCatalogs)
|
||||
xmlCatalogPrintDebug(
|
||||
"Ignoring repeated nextCatalog %s\n", entry->URL);
|
||||
xmlFreeCatalogEntry(entry, NULL);
|
||||
entry = NULL;
|
||||
break;
|
||||
}
|
||||
prev = prev->next;
|
||||
}
|
||||
}
|
||||
if (entry != NULL) {
|
||||
if (parent != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user