[Libreoffice-commits] core.git: unoxml/source
Andres Gomez
agomez at igalia.com
Fri Sep 20 01:54:27 PDT 2013
unoxml/source/dom/element.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit a30652bfef1ca8c8d6a20a01aabc700b92978fb3
Author: Andres Gomez <agomez at igalia.com>
Date: Mon Sep 16 15:56:53 2013 +0300
unoxml: avoid SIGSEV when xmlNsPtr prefix is NULL
When serializing a XDocument with "xmlns" elements, they usually come
with a prefix like in xmlns:xlink="http://www.w3.org/1999/xlink".
When the prefix doesn exist like in xmlns="", the prefix member of the
xmlNsPtr structure is NULL and unsafe operations on it like "strlen"
may cause a SIGSEV.
Change-Id: Icdfcddeccb37c246a48aa1239b7f3c5b0b3727e3
Reviewed-on: https://gerrit.libreoffice.org/6003
Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx
index 87dba8a..e41420a 100644
--- a/unoxml/source/dom/element.cxx
+++ b/unoxml/source/dom/element.cxx
@@ -55,7 +55,7 @@ namespace DOM
OUString type = "";
// add namespace definitions to attributes
for (xmlNsPtr pNs = m_aNodePtr->nsDef; pNs != 0; pNs = pNs->next) {
- const xmlChar *pPrefix = pNs->prefix;
+ const xmlChar *pPrefix = pNs->prefix ? pNs->prefix : (const xmlChar*)"";
OUString prefix(reinterpret_cast<const sal_Char*>(pPrefix),
strlen(reinterpret_cast<const char*>(pPrefix)),
RTL_TEXTENCODING_UTF8);
More information about the Libreoffice-commits
mailing list