File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -860,6 +860,11 @@ PHP_METHOD(XMLReader, open)
860
860
RETURN_THROWS ();
861
861
}
862
862
863
+ if (encoding && CHECK_NULL_PATH (encoding , encoding_len )) {
864
+ php_error_docref (NULL , E_WARNING , "Encoding must not contain NUL bytes" );
865
+ RETURN_FALSE ;
866
+ }
867
+
863
868
valid_file = _xmlreader_get_valid_file_path (source , resolved_path , MAXPATHLEN );
864
869
865
870
if (valid_file ) {
@@ -1035,6 +1040,11 @@ PHP_METHOD(XMLReader, XML)
1035
1040
RETURN_THROWS ();
1036
1041
}
1037
1042
1043
+ if (encoding && CHECK_NULL_PATH (encoding , encoding_len )) {
1044
+ php_error_docref (NULL , E_WARNING , "Encoding must not contain NUL bytes" );
1045
+ RETURN_FALSE ;
1046
+ }
1047
+
1038
1048
inputbfr = xmlParserInputBufferCreateMem (source , source_len , XML_CHAR_ENCODING_NONE );
1039
1049
1040
1050
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