@@ -1700,7 +1700,7 @@ PHP_FUNCTION(dom_document_save)
1700
1700
char * file ;
1701
1701
long options = 0 ;
1702
1702
1703
- if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Os |l" , & id , dom_document_class_entry , & file , & file_len , & options ) == FAILURE ) {
1703
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Op |l" , & id , dom_document_class_entry , & file , & file_len , & options ) == FAILURE ) {
1704
1704
return ;
1705
1705
}
1706
1706
@@ -1930,7 +1930,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
1930
1930
int is_valid ;
1931
1931
char resolved_path [MAXPATHLEN + 1 ];
1932
1932
1933
- if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Op |l" , & id , dom_document_class_entry , & source , & source_len , & flags ) == FAILURE ) {
1933
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Os |l" , & id , dom_document_class_entry , & source , & source_len , & flags ) == FAILURE ) {
1934
1934
return ;
1935
1935
}
1936
1936
@@ -1943,6 +1943,10 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
1943
1943
1944
1944
switch (type ) {
1945
1945
case DOM_LOAD_FILE :
1946
+ if (CHECK_NULL_PATH (source , source_len )) {
1947
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid Schema file source" );
1948
+ RETURN_FALSE ;
1949
+ }
1946
1950
valid_file = _dom_get_valid_file_path (source , resolved_path , MAXPATHLEN TSRMLS_CC );
1947
1951
if (!valid_file ) {
1948
1952
php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid Schema file source" );
@@ -2026,7 +2030,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
2026
2030
int is_valid ;
2027
2031
char resolved_path [MAXPATHLEN + 1 ];
2028
2032
2029
- if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Op " , & id , dom_document_class_entry , & source , & source_len ) == FAILURE ) {
2033
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Os " , & id , dom_document_class_entry , & source , & source_len ) == FAILURE ) {
2030
2034
return ;
2031
2035
}
2032
2036
@@ -2039,6 +2043,10 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
2039
2043
2040
2044
switch (type ) {
2041
2045
case DOM_LOAD_FILE :
2046
+ if (CHECK_NULL_PATH (source , source_len )) {
2047
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid RelaxNG file source" );
2048
+ RETURN_FALSE ;
2049
+ }
2042
2050
valid_file = _dom_get_valid_file_path (source , resolved_path , MAXPATHLEN TSRMLS_CC );
2043
2051
if (!valid_file ) {
2044
2052
php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid RelaxNG file source" );
@@ -2119,7 +2127,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
2119
2127
2120
2128
id = getThis ();
2121
2129
2122
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "p |l" , & source , & source_len , & options ) == FAILURE ) {
2130
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "s |l" , & source , & source_len , & options ) == FAILURE ) {
2123
2131
return ;
2124
2132
}
2125
2133
@@ -2129,6 +2137,10 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
2129
2137
}
2130
2138
2131
2139
if (mode == DOM_LOAD_FILE ) {
2140
+ if (CHECK_NULL_PATH (source , source_len )) {
2141
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid file source ");
2142
+ RETURN_FALSE ;
2143
+ }
2132
2144
ctxt = htmlCreateFileParserCtxt (source , NULL );
2133
2145
} else {
2134
2146
source_len = xmlStrlen (source );
@@ -2217,7 +2229,7 @@ PHP_FUNCTION(dom_document_save_html_file)
2217
2229
char * file ;
2218
2230
const char * encoding ;
2219
2231
2220
- if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Os " , & id , dom_document_class_entry , & file , & file_len ) == FAILURE ) {
2232
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Op " , & id , dom_document_class_entry , & file , & file_len ) == FAILURE ) {
2221
2233
return ;
2222
2234
}
2223
2235
0 commit comments