1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-04-01 10:50:08 +03:00

Add NULL checks

Short-lived regression.
This commit is contained in:
Nick Wellnhofer 2024-07-18 01:59:25 +02:00
parent 4e93425a7f
commit 5862e9dd37
2 changed files with 6 additions and 1 deletions

4
buf.c
View File

@ -558,7 +558,7 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, size_t len) {
/**
* xmlBufCat:
* @buf: the buffer to add to
* @str: the #xmlChar string
* @str: the #xmlChar string (optional)
*
* Append a zero terminated string to an XML buffer.
*
@ -567,6 +567,8 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, size_t len) {
*/
int
xmlBufCat(xmlBufPtr buf, const xmlChar *str) {
if (str == NULL)
return(0);
return(xmlBufAdd(buf, str, strlen((const char *) str)));
}

View File

@ -166,6 +166,9 @@ xmlSerializeText(xmlOutputBufferPtr buf, const xmlChar *string,
const char *cur;
const char *tab;
if (string == NULL)
return;
if (flags & XML_ESCAPE_ATTR)
tab = xmlEscapeTabAttr;
else