1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01: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:
Niels Dossche
2024-04-01 22:47:38 +02:00
committed by GitHub
parent eb1cdb5b72
commit ce2dd0b20b

View File

@@ -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->doc = lxml_doc;
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;
} else {
return xmlNewDocTextLen(lxml_doc, (const xmlChar *) data, data_length);