@@ -1761,7 +1761,7 @@ PHP_FUNCTION(dom_document_save)
1761
1761
char * file ;
1762
1762
long options = 0 ;
1763
1763
1764
- if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Os |l" , & id , dom_document_class_entry , & file , & file_len , & options ) == FAILURE ) {
1764
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Op |l" , & id , dom_document_class_entry , & file , & file_len , & options ) == FAILURE ) {
1765
1765
return ;
1766
1766
}
1767
1767
@@ -2004,6 +2004,10 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
2004
2004
2005
2005
switch (type ) {
2006
2006
case DOM_LOAD_FILE :
2007
+ if (CHECK_NULL_PATH (source , source_len )) {
2008
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid Schema file source" );
2009
+ RETURN_FALSE ;
2010
+ }
2007
2011
valid_file = _dom_get_valid_file_path (source , resolved_path , MAXPATHLEN TSRMLS_CC );
2008
2012
if (!valid_file ) {
2009
2013
php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid Schema file source" );
@@ -2087,7 +2091,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
2087
2091
int is_valid ;
2088
2092
char resolved_path [MAXPATHLEN + 1 ];
2089
2093
2090
- if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Op " , & id , dom_document_class_entry , & source , & source_len ) == FAILURE ) {
2094
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Os " , & id , dom_document_class_entry , & source , & source_len ) == FAILURE ) {
2091
2095
return ;
2092
2096
}
2093
2097
@@ -2100,6 +2104,10 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
2100
2104
2101
2105
switch (type ) {
2102
2106
case DOM_LOAD_FILE :
2107
+ if (CHECK_NULL_PATH (source , source_len )) {
2108
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid RelaxNG file source" );
2109
+ RETURN_FALSE ;
2110
+ }
2103
2111
valid_file = _dom_get_valid_file_path (source , resolved_path , MAXPATHLEN TSRMLS_CC );
2104
2112
if (!valid_file ) {
2105
2113
php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid RelaxNG file source" );
@@ -2180,7 +2188,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
2180
2188
2181
2189
id = getThis ();
2182
2190
2183
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "p |l" , & source , & source_len , & options ) == FAILURE ) {
2191
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "s |l" , & source , & source_len , & options ) == FAILURE ) {
2184
2192
return ;
2185
2193
}
2186
2194
@@ -2190,6 +2198,10 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
2190
2198
}
2191
2199
2192
2200
if (mode == DOM_LOAD_FILE ) {
2201
+ if (CHECK_NULL_PATH (source , source_len )) {
2202
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid file source ");
2203
+ RETURN_FALSE ;
2204
+ }
2193
2205
ctxt = htmlCreateFileParserCtxt (source , NULL );
2194
2206
} else {
2195
2207
source_len = xmlStrlen (source );
@@ -2278,7 +2290,7 @@ PHP_FUNCTION(dom_document_save_html_file)
2278
2290
char * file ;
2279
2291
const char * encoding ;
2280
2292
2281
- if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Os " , & id , dom_document_class_entry , & file , & file_len ) == FAILURE ) {
2293
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Op " , & id , dom_document_class_entry , & file , & file_len ) == FAILURE ) {
2282
2294
return ;
2283
2295
}
2284
2296
0 commit comments