summaryrefslogtreecommitdiff
path: root/sql/item_xmlfunc.cc
diff options
context:
space:
mode:
authorbar@mysql.com <>2007-05-02 13:18:07 +0500
committerbar@mysql.com <>2007-05-02 13:18:07 +0500
commitea6bb0286b9ef456661ebe1b9e4f6af7726b8b7f (patch)
treea635a5106e1a6ddc6ff968289f3571ab9b9e13b5 /sql/item_xmlfunc.cc
parent44f02c570a3b04dbb248ce875a8d0d0f980c79cb (diff)
downloadmariadb-git-ea6bb0286b9ef456661ebe1b9e4f6af7726b8b7f.tar.gz
Bug#27898 UPDATEXML Crashes the Server!
Problem: when replacing the root element, UpdateXML erroneously tried to mix old XML content with the replacement string, which led to crash. Fix: don't use the old XML content in these cases, just return the replacement string.
Diffstat (limited to 'sql/item_xmlfunc.cc')
-rw-r--r--sql/item_xmlfunc.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index 26474990644..d29738429b7 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -2768,6 +2768,16 @@ String *Item_func_xml_update::val_str(String *str)
nodebeg+= fltbeg->num;
+ if (!nodebeg->level)
+ {
+ /*
+ Root element, without NameTest:
+ UpdateXML(xml, '/', 'replacement');
+ Just return the replacement string.
+ */
+ return rep;
+ }
+
tmp_value.length(0);
tmp_value.set_charset(collation.collation);
uint offs= nodebeg->type == MY_XML_NODE_TAG ? 1 : 0;