mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix potential NULL pointer argument to memcpy (#13859)
This is only possible when the length is 0, but memcpy doesn't like NULL pointers, as UBSAN trips over it.
This commit is contained in:
parent
eb1cdb5b72
commit
ce2dd0b20b
1 changed files with 3 additions and 1 deletions
|
@ -86,7 +86,9 @@ static xmlNodePtr lexbor_libxml2_bridge_new_text_node_fast(xmlDocPtr lxml_doc, c
|
||||||
lxml_text->type = XML_TEXT_NODE;
|
lxml_text->type = XML_TEXT_NODE;
|
||||||
lxml_text->doc = lxml_doc;
|
lxml_text->doc = lxml_doc;
|
||||||
lxml_text->content = BAD_CAST &lxml_text->properties;
|
lxml_text->content = BAD_CAST &lxml_text->properties;
|
||||||
memcpy(lxml_text->content, data, data_length);
|
if (data != NULL) {
|
||||||
|
memcpy(lxml_text->content, data, data_length);
|
||||||
|
}
|
||||||
return lxml_text;
|
return lxml_text;
|
||||||
} else {
|
} else {
|
||||||
return xmlNewDocTextLen(lxml_doc, (const xmlChar *) data, data_length);
|
return xmlNewDocTextLen(lxml_doc, (const xmlChar *) data, data_length);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue