author | Mike Sullivan <Mike.Sullivan@Oracle.COM> |
Wed, 29 Aug 2012 11:05:56 -0700 | |
changeset 957 | 255465c5756f |
parent 624 | c33a34e65bdb |
permissions | -rw-r--r-- |
624
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
1 |
This patch taken directly from upstream: |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
2 |
http://git.gnome.org/browse/libxml2/commit/?id=69f04562f75212bfcabecd190ea8b06ace28ece2 |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
3 |
--- libxml2-2.7.6/encoding.c Thu Sep 24 08:31:59 2009 |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
4 |
+++ libxml2-2.7.6/new.encoding.c Mon Oct 24 11:11:46 2011 |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
5 |
@@ -1771,7 +1771,7 @@ |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
6 |
if (in == NULL) return(-1); |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
7 |
|
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
8 |
/* calculate space available */ |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
9 |
- written = out->size - out->use; |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
10 |
+ written = out->size - out->use - 1; /* count '\0' */ |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
11 |
toconv = in->use; |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
12 |
/* |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
13 |
* echo '<?xml version="1.0" encoding="UCS4"?>' | wc -c => 38 |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
14 |
@@ -1892,7 +1892,7 @@ |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
15 |
toconv = in->use; |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
16 |
if (toconv == 0) |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
17 |
return (0); |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
18 |
- written = out->size - out->use; |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
19 |
+ written = out->size - out->use - 1; /* count '\0' */ |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
20 |
if (toconv * 2 >= written) { |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
21 |
xmlBufferGrow(out, out->size + toconv * 2); |
c33a34e65bdb
7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff
changeset
|
22 |
written = out->size - out->use - 1; |