From 7892eee207bddee85c53cd762f31c09a3e53942d Mon Sep 17 00:00:00 2001 From: Takeshi Nakatani Date: Tue, 26 Oct 2021 11:32:17 +0000 Subject: [PATCH] Fixed a bug that copied without considering the length of xmlChar --- src/s3fs_xml.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/s3fs_xml.cpp b/src/s3fs_xml.cpp index d020954..00ffe68 100644 --- a/src/s3fs_xml.cpp +++ b/src/s3fs_xml.cpp @@ -52,7 +52,10 @@ static bool GetXmlNsUrl(xmlDocPtr doc, std::string& nsurl) xmlNsPtr* nslist = xmlGetNsList(doc, pRootNode); if(nslist){ if(nslist[0] && nslist[0]->href){ - strNs = (const char*)(nslist[0]->href); + int len = xmlStrlen(nslist[0]->href); + if(0 < len){ + strNs = std::string((const char*)(nslist[0]->href), len); + } } S3FS_XMLFREE(nslist); }