@@ -1562,7 +1562,7 @@ PHP_FUNCTION(dom_document_save)
1562
1562
char * file ;
1563
1563
zend_long options = 0 ;
1564
1564
1565
- if (zend_parse_method_parameters (ZEND_NUM_ARGS (), getThis (), "Os |l" , & id , dom_document_class_entry , & file , & file_len , & options ) == FAILURE ) {
1565
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS (), getThis (), "Op |l" , & id , dom_document_class_entry , & file , & file_len , & options ) == FAILURE ) {
1566
1566
return ;
1567
1567
}
1568
1568
@@ -1793,7 +1793,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
1793
1793
int is_valid ;
1794
1794
char resolved_path [MAXPATHLEN + 1 ];
1795
1795
1796
- if (zend_parse_method_parameters (ZEND_NUM_ARGS (), getThis (), "Op |l" , & id , dom_document_class_entry , & source , & source_len , & flags ) == FAILURE ) {
1796
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS (), getThis (), "Os |l" , & id , dom_document_class_entry , & source , & source_len , & flags ) == FAILURE ) {
1797
1797
return ;
1798
1798
}
1799
1799
@@ -1806,7 +1806,11 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
1806
1806
1807
1807
switch (type ) {
1808
1808
case DOM_LOAD_FILE :
1809
- valid_file = _dom_get_valid_file_path (source , resolved_path , MAXPATHLEN );
1809
+ if (CHECK_NULL_PATH (source , source_len )) {
1810
+ php_error_docref (NULL , E_WARNING , "Invalid Schema file source" );
1811
+ RETURN_FALSE ;
1812
+ }
1813
+ valid_file = _dom_get_valid_file_path (source , resolved_path , MAXPATHLEN TSRMLS_CC );
1810
1814
if (!valid_file ) {
1811
1815
php_error_docref (NULL , E_WARNING , "Invalid Schema file source" );
1812
1816
RETURN_FALSE ;
@@ -1889,7 +1893,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
1889
1893
int is_valid ;
1890
1894
char resolved_path [MAXPATHLEN + 1 ];
1891
1895
1892
- if (zend_parse_method_parameters (ZEND_NUM_ARGS (), getThis (), "Op " , & id , dom_document_class_entry , & source , & source_len ) == FAILURE ) {
1896
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS (), getThis (), "Os " , & id , dom_document_class_entry , & source , & source_len ) == FAILURE ) {
1893
1897
return ;
1894
1898
}
1895
1899
@@ -1902,7 +1906,11 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
1902
1906
1903
1907
switch (type ) {
1904
1908
case DOM_LOAD_FILE :
1905
- valid_file = _dom_get_valid_file_path (source , resolved_path , MAXPATHLEN );
1909
+ if (CHECK_NULL_PATH (source , source_len )) {
1910
+ php_error_docref (NULL , E_WARNING , "Invalid RelaxNG file source" );
1911
+ RETURN_FALSE ;
1912
+ }
1913
+ valid_file = _dom_get_valid_file_path (source , resolved_path , MAXPATHLEN TSRMLS_CC );
1906
1914
if (!valid_file ) {
1907
1915
php_error_docref (NULL , E_WARNING , "Invalid RelaxNG file source" );
1908
1916
RETURN_FALSE ;
@@ -1983,7 +1991,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
1983
1991
1984
1992
id = getThis ();
1985
1993
1986
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "p |l" , & source , & source_len , & options ) == FAILURE ) {
1994
+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "s |l" , & source , & source_len , & options ) == FAILURE ) {
1987
1995
return ;
1988
1996
}
1989
1997
@@ -1993,6 +2001,10 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
1993
2001
}
1994
2002
1995
2003
if (mode == DOM_LOAD_FILE ) {
2004
+ if (CHECK_NULL_PATH (source , source_len )) {
2005
+ php_error_docref (NULL , E_WARNING , "Invalid file source" );
2006
+ RETURN_FALSE ;
2007
+ }
1996
2008
ctxt = htmlCreateFileParserCtxt (source , NULL );
1997
2009
} else {
1998
2010
source_len = xmlStrlen ((xmlChar * ) source );
@@ -2082,7 +2094,7 @@ PHP_FUNCTION(dom_document_save_html_file)
2082
2094
char * file ;
2083
2095
const char * encoding ;
2084
2096
2085
- if (zend_parse_method_parameters (ZEND_NUM_ARGS (), getThis (), "Os " , & id , dom_document_class_entry , & file , & file_len ) == FAILURE ) {
2097
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS (), getThis (), "Op " , & id , dom_document_class_entry , & file , & file_len ) == FAILURE ) {
2086
2098
return ;
2087
2099
}
2088
2100
0 commit comments