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 @@ -31,6 +31,9 @@ PHP NEWS
31
31
- Opcache:
32
32
. Fixed bug #80900 (switch statement behavior inside function). (twosee)
33
33
34
+ - XMLReader:
35
+ . Fixed bug #73246 (XMLReader: encoding length not checked). (cmb)
36
+
34
37
29 Apr 2021, PHP 7.4.18
35
38
36
39
- Core:
Original file line number Diff line number Diff line change @@ -873,6 +873,11 @@ PHP_METHOD(xmlreader, open)
873
873
RETURN_FALSE ;
874
874
}
875
875
876
+ if (encoding && CHECK_NULL_PATH (encoding , encoding_len )) {
877
+ php_error_docref (NULL , E_WARNING , "Encoding must not contain NUL bytes" );
878
+ RETURN_FALSE ;
879
+ }
880
+
876
881
valid_file = _xmlreader_get_valid_file_path (source , resolved_path , MAXPATHLEN );
877
882
878
883
if (valid_file ) {
@@ -1055,6 +1060,11 @@ PHP_METHOD(xmlreader, XML)
1055
1060
RETURN_FALSE ;
1056
1061
}
1057
1062
1063
+ if (encoding && CHECK_NULL_PATH (encoding , encoding_len )) {
1064
+ php_error_docref (NULL , E_WARNING , "Encoding must not contain NUL bytes" );
1065
+ RETURN_FALSE ;
1066
+ }
1067
+
1058
1068
inputbfr = xmlParserInputBufferCreateMem (source , source_len , XML_CHAR_ENCODING_NONE );
1059
1069
1060
1070
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