mirror of
https://github.com/php/php-src.git
synced 2024-12-01 13:54:10 +08:00
Merge branch 'PHP-8.0'
* PHP-8.0: Fix #73246: XMLReader: encoding length not checked
This commit is contained in:
commit
768e8b8319
@ -860,6 +860,11 @@ PHP_METHOD(XMLReader, open)
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (encoding && CHECK_NULL_PATH(encoding, encoding_len)) {
|
||||
php_error_docref(NULL, E_WARNING, "Encoding must not contain NUL bytes");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
valid_file = _xmlreader_get_valid_file_path(source, resolved_path, MAXPATHLEN );
|
||||
|
||||
if (valid_file) {
|
||||
@ -1035,6 +1040,11 @@ PHP_METHOD(XMLReader, XML)
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (encoding && CHECK_NULL_PATH(encoding, encoding_len)) {
|
||||
php_error_docref(NULL, E_WARNING, "Encoding must not contain NUL bytes");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
inputbfr = xmlParserInputBufferCreateMem(source, source_len, XML_CHAR_ENCODING_NONE);
|
||||
|
||||
if (inputbfr != NULL) {
|
||||
|
16
ext/xmlreader/tests/bug73246.phpt
Normal file
16
ext/xmlreader/tests/bug73246.phpt
Normal file
@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #73246 (XMLReader: encoding length not checked)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("xmlreader")) die("skip xmlreader extension not available");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$reader = new XMLReader();
|
||||
$reader->open(__FILE__, "UTF\0-8");
|
||||
$reader->XML('<?xml version="1.0"?><root/>', "UTF\0-8");
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: XMLReader::open(): Encoding must not contain NUL bytes in %s on line %d
|
||||
|
||||
Warning: XMLReader::XML(): Encoding must not contain NUL bytes in %s on line %d
|
Loading…
Reference in New Issue
Block a user