From 8aa54aa7eefbf738999ae855d9192bc57756201e Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Mon, 7 Jul 2025 08:53:57 +0900 Subject: [PATCH] Fix incompatibility with libxml2 >= 2.14 libxml2 has deprecated the members of xmlBuffer, and it is recommended to access them with dedicated routines. We have only one case in the tree where this shows an impact: xml2/xpath.c where "content" was getting directly accessed. The rest of the code looked fine, checking the PostgreSQL code with libxml2 close to the top of its "2.14" branch. xmlBufferContent() exists since year 2000 based on a check of the upstream libxml2 tree, so let's switch to it. Like 400928b83bd2, backpatch all the way down as this can have an impact on all the branches already released once newer versions of libxml2 get more popular. Reported-by: Walid Ibrahim Reviewed-by: Tom Lane Discussion: https://postgr.es/m/aGdSdcR4QTjEHX6s@paquier.xyz Backpatch-through: 13 --- contrib/xml2/xpath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c index 3f733405ec6..11216b9b7f9 100644 --- a/contrib/xml2/xpath.c +++ b/contrib/xml2/xpath.c @@ -209,7 +209,7 @@ pgxmlNodeSetToText(xmlNodeSetPtr nodeset, xmlBufferWriteChar(buf, ">"); } - result = xmlStrdup(buf->content); + result = xmlStrdup(xmlBufferContent(buf)); if (result == NULL || pg_xml_error_occurred(xmlerrcxt)) xml_ereport(xmlerrcxt, ERROR, ERRCODE_OUT_OF_MEMORY, "could not allocate result"); -- 2.39.5