File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ PHP NEWS
26
26
. Fixed bug #80933 (SplFileObject::DROP_NEW_LINE is broken for NUL and CR).
27
27
(cmb, Nikita)
28
28
29
+ - XMLReader:
30
+ . Fixed bug #73246 (XMLReader: encoding length not checked). (cmb)
31
+
29
32
29 Apr 2021, PHP 8.0.5
30
33
31
34
- Core:
Original file line number Diff line number Diff line change @@ -862,6 +862,11 @@ PHP_METHOD(XMLReader, open)
862
862
RETURN_THROWS ();
863
863
}
864
864
865
+ if (encoding && CHECK_NULL_PATH (encoding , encoding_len )) {
866
+ php_error_docref (NULL , E_WARNING , "Encoding must not contain NUL bytes" );
867
+ RETURN_FALSE ;
868
+ }
869
+
865
870
valid_file = _xmlreader_get_valid_file_path (source , resolved_path , MAXPATHLEN );
866
871
867
872
if (valid_file ) {
@@ -1037,6 +1042,11 @@ PHP_METHOD(XMLReader, XML)
1037
1042
RETURN_THROWS ();
1038
1043
}
1039
1044
1045
+ if (encoding && CHECK_NULL_PATH (encoding , encoding_len )) {
1046
+ php_error_docref (NULL , E_WARNING , "Encoding must not contain NUL bytes" );
1047
+ RETURN_FALSE ;
1048
+ }
1049
+
1040
1050
inputbfr = xmlParserInputBufferCreateMem (source , source_len , XML_CHAR_ENCODING_NONE );
1041
1051
1042
1052
if (inputbfr != NULL ) {
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #73246 (XMLReader: encoding length not checked)
3
+ --SKIPIF--
4
+ <?php
5
+ if (!extension_loaded ("xmlreader " )) die ("skip xmlreader extension not available " );
6
+ ?>
7
+ --FILE--
8
+ <?php
9
+ $ reader = new XMLReader ();
10
+ $ reader ->open (__FILE__ , "UTF \0-8 " );
11
+ $ reader ->XML ('<?xml version="1.0"?><root/> ' , "UTF \0-8 " );
12
+ ?>
13
+ --EXPECTF--
14
+ Warning: XMLReader::open(): Encoding must not contain NUL bytes in %s on line %d
15
+
16
+ Warning: XMLReader::XML(): Encoding must not contain NUL bytes in %s on line %d
You can’t perform that action at this time.
0 commit comments