components/libxml2/patches/10.CVE-2011-0216.patch
changeset 624 c33a34e65bdb
equal deleted inserted replaced
623:15f87c23a86e 624:c33a34e65bdb
       
     1 This patch taken directly from upstream:
       
     2 http://git.gnome.org/browse/libxml2/commit/?id=69f04562f75212bfcabecd190ea8b06ace28ece2
       
     3 --- libxml2-2.7.6/encoding.c	Thu Sep 24 08:31:59 2009
       
     4 +++ libxml2-2.7.6/new.encoding.c	Mon Oct 24 11:11:46 2011
       
     5 @@ -1771,7 +1771,7 @@
       
     6      if (in == NULL) return(-1);
       
     7  
       
     8      /* calculate space available */
       
     9 -    written = out->size - out->use;
       
    10 +    written = out->size - out->use - 1; /* count '\0' */
       
    11      toconv = in->use;
       
    12      /*
       
    13       * echo '<?xml version="1.0" encoding="UCS4"?>' | wc -c => 38
       
    14 @@ -1892,7 +1892,7 @@
       
    15      toconv = in->use;
       
    16      if (toconv == 0)
       
    17          return (0);
       
    18 -    written = out->size - out->use;
       
    19 +    written = out->size - out->use - 1; /* count '\0' */
       
    20      if (toconv * 2 >= written) {
       
    21          xmlBufferGrow(out, out->size + toconv * 2);
       
    22          written = out->size - out->use - 1;