mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-16149: Null pointer dereference in DOMElement->getAttributeNames()
This commit is contained in:
2
NEWS
2
NEWS
@@ -22,6 +22,8 @@ PHP NEWS
|
||||
- DOM:
|
||||
. Fixed bug GH-16039 (Segmentation fault (access null pointer) in
|
||||
ext/dom/parentnode/tree.c). (nielsdos)
|
||||
. Fixed bug GH-16149 (Null pointer dereference in
|
||||
DOMElement->getAttributeNames()). (nielsdos)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug GHSA-865w-9rf3-2wh5 (Logs from childrens may be altered).
|
||||
|
||||
@@ -361,7 +361,11 @@ PHP_METHOD(DOMElement, getAttributeNames)
|
||||
if (!php_dom_follow_spec_intern(intern)) {
|
||||
for (xmlNsPtr nsptr = nodep->nsDef; nsptr; nsptr = nsptr->next) {
|
||||
const char *prefix = (const char *) nsptr->prefix;
|
||||
ZVAL_NEW_STR(&tmp, dom_node_concatenated_name_helper(strlen(prefix), prefix, strlen("xmlns"), (const char *) "xmlns"));
|
||||
if (prefix == NULL) {
|
||||
ZVAL_STRING(&tmp, "xmlns");
|
||||
} else {
|
||||
ZVAL_NEW_STR(&tmp, dom_node_concatenated_name_helper(strlen(prefix), prefix, strlen("xmlns"), (const char *) "xmlns"));
|
||||
}
|
||||
zend_hash_next_index_insert(ht, &tmp);
|
||||
}
|
||||
}
|
||||
|
||||
14
ext/dom/tests/gh16149.phpt
Normal file
14
ext/dom/tests/gh16149.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
GH-16149 (Null pointer dereference in DOMElement->getAttributeNames())
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
$element = new DOMElement("b", null, "a");
|
||||
var_dump($element->getAttributeNames());
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(5) "xmlns"
|
||||
}
|
||||
Reference in New Issue
Block a user