mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-23 01:52:48 +03:00
Fixed a segfault during text concatenation when validating a node tree:
* xmlschemas.c xmlstring.c: Fixed a segfault during text concatenation when validating a node tree: xmlStrncat was called with a @len of -1; but unlike xmlStrncatNew, it does not calculate the length automatically in such a case (reported by Judy Hay on the mailing list). Updated the descriptions of the involved string functions to note this.
This commit is contained in:
11
ChangeLog
11
ChangeLog
@@ -1,3 +1,14 @@
|
|||||||
|
Tue Dec 20 11:43:06 CET 2005 Kasimier Buchcik <libxml2-cvs@cazic.ne>
|
||||||
|
|
||||||
|
* xmlschemas.c xmlstring.c: Fixed a segfault during
|
||||||
|
text concatenation when validating a node tree:
|
||||||
|
xmlStrncat was called with a @len of -1; but unlike
|
||||||
|
xmlStrncatNew, it does not calculate the length
|
||||||
|
automatically in such a case (reported by Judy Hay
|
||||||
|
on the mailing list).
|
||||||
|
Updated the descriptions of the involved string
|
||||||
|
functions to note this.
|
||||||
|
|
||||||
Thu Dec 15 12:11:07 CET 2005 Daniel Veillard <daniel@veillard.com>
|
Thu Dec 15 12:11:07 CET 2005 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* nanohttp.c: applied patch from Gary Coady to accept gzipped
|
* nanohttp.c: applied patch from Gary Coady to accept gzipped
|
||||||
|
@@ -26337,6 +26337,8 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (len < 0)
|
||||||
|
len = xmlStrlen(value);
|
||||||
/*
|
/*
|
||||||
* Concat the value.
|
* Concat the value.
|
||||||
*/
|
*/
|
||||||
|
10
xmlstring.c
10
xmlstring.c
@@ -437,7 +437,8 @@ xmlStrlen(const xmlChar *str) {
|
|||||||
* @len: the length of @add
|
* @len: the length of @add
|
||||||
*
|
*
|
||||||
* a strncat for array of xmlChar's, it will extend @cur with the len
|
* a strncat for array of xmlChar's, it will extend @cur with the len
|
||||||
* first bytes of @add.
|
* first bytes of @add. Note that if @len < 0 then this is an API error
|
||||||
|
* and NULL will be returned.
|
||||||
*
|
*
|
||||||
* Returns a new xmlChar *, the original @cur is reallocated if needed
|
* Returns a new xmlChar *, the original @cur is reallocated if needed
|
||||||
* and should not be freed
|
* and should not be freed
|
||||||
@@ -450,6 +451,8 @@ xmlStrncat(xmlChar *cur, const xmlChar *add, int len) {
|
|||||||
|
|
||||||
if ((add == NULL) || (len == 0))
|
if ((add == NULL) || (len == 0))
|
||||||
return(cur);
|
return(cur);
|
||||||
|
if (len < 0)
|
||||||
|
return(NULL);
|
||||||
if (cur == NULL)
|
if (cur == NULL)
|
||||||
return(xmlStrndup(add, len));
|
return(xmlStrndup(add, len));
|
||||||
|
|
||||||
@@ -468,10 +471,11 @@ xmlStrncat(xmlChar *cur, const xmlChar *add, int len) {
|
|||||||
* xmlStrncatNew:
|
* xmlStrncatNew:
|
||||||
* @str1: first xmlChar string
|
* @str1: first xmlChar string
|
||||||
* @str2: second xmlChar string
|
* @str2: second xmlChar string
|
||||||
* @len: the len of @str2
|
* @len: the len of @str2 or < 0
|
||||||
*
|
*
|
||||||
* same as xmlStrncat, but creates a new string. The original
|
* same as xmlStrncat, but creates a new string. The original
|
||||||
* two strings are not freed.
|
* two strings are not freed. If @len is < 0 then the length
|
||||||
|
* will be calculated automatically.
|
||||||
*
|
*
|
||||||
* Returns a new xmlChar * or NULL
|
* Returns a new xmlChar * or NULL
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user