>From 863e4ce404d82d4df81cc745b3bb9c0262571da6 Mon Sep 17 00:00:00 2001
From: Thomas Faber <thfabba@gmx.de>
Date: Fri, 14 Sep 2012 09:03:39 +0200
Subject: msxml3: Do not directly write to resource section.

---
 dlls/msxml3/schema.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/msxml3/schema.c b/dlls/msxml3/schema.c
index 2f31016..e739fcb 100644
--- a/dlls/msxml3/schema.c
+++ b/dlls/msxml3/schema.c
@@ -68,7 +68,7 @@ static const xmlChar XDR_schema[] = "Schema";
 static const xmlChar XDR_nsURI[] = "urn:schemas-microsoft-com:xml-data";
 static const xmlChar DT_nsURI[] = "urn:schemas-microsoft-com:datatypes";
 
-static xmlChar const*   datatypes_src;
+static xmlChar *        datatypes_src;
 static int              datatypes_len;
 static HGLOBAL          datatypes_handle;
 static HRSRC            datatypes_rsrc;
@@ -747,9 +747,11 @@ void schemasInit(void)
     /* Resource is loaded as raw data,
      * need a null-terminated string */
     while (buf[len] != '>')
-        buf[len--] = 0;
-    datatypes_src = buf;
+        len--;
     datatypes_len = len + 1;
+    datatypes_src = HeapAlloc(GetProcessHeap(), 0, datatypes_len + 1);
+    memcpy(datatypes_src, buf, datatypes_len);
+    datatypes_src[datatypes_len] = 0;
 
     if (xmlGetExternalEntityLoader() != external_entity_loader)
     {
@@ -761,6 +763,7 @@ void schemasInit(void)
 void schemasCleanup(void)
 {
     xmlSchemaFree(datatypes_schema);
+    HeapFree(GetProcessHeap(), 0, datatypes_src);
     xmlSetExternalEntityLoader(_external_entity_loader);
 }
 
-- 
1.7.11.msysgit.1


