summaryrefslogtreecommitdiff
path: root/ext/oci8
diff options
context:
space:
mode:
authorChristopher Jones <sixd@php.net>2020-09-08 15:48:48 +1000
committerChristopher Jones <sixd@php.net>2020-09-08 15:48:48 +1000
commit6134bf9ab1120357180487ca74e845581d6dd034 (patch)
tree8a6b14e9b15da96eeb000a4d22915502a3bc959c /ext/oci8
parent8a49310f4e1aae962aaecc8bfafaf39877167c52 (diff)
downloadphp-git-6134bf9ab1120357180487ca74e845581d6dd034.tar.gz
Fix parsing regression from PHP 7
Diffstat (limited to 'ext/oci8')
-rw-r--r--ext/oci8/oci8_interface.c14
-rw-r--r--ext/oci8/tests/null_byte_1.phpt8
2 files changed, 16 insertions, 6 deletions
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index 2ecf1d4bc4..500011ab51 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -284,7 +284,7 @@ PHP_FUNCTION(oci_lob_import)
char *filename;
size_t filename_len;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Op", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) {
RETURN_THROWS();
}
@@ -293,6 +293,11 @@ PHP_FUNCTION(oci_lob_import)
RETURN_FALSE;
}
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ php_error_docref(NULL, E_WARNING, "filename must not contain null bytes");
+ RETURN_FALSE;
+ }
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_import(descriptor, filename)) {
@@ -835,7 +840,7 @@ PHP_FUNCTION(oci_lob_export)
php_stream *stream;
ub4 lob_length;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Op|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) {
RETURN_THROWS();
}
@@ -864,6 +869,11 @@ PHP_FUNCTION(oci_lob_export)
RETURN_FALSE;
}
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ php_error_docref(NULL, E_WARNING, "filename must not contain null bytes");
+ RETURN_FALSE;
+ }
+
PHP_OCI_ZVAL_TO_DESCRIPTOR(tmp, descriptor);
if (php_oci_lob_get_length(descriptor, &lob_length)) {
diff --git a/ext/oci8/tests/null_byte_1.phpt b/ext/oci8/tests/null_byte_1.phpt
index 06abe04957..6da6cad5ad 100644
--- a/ext/oci8/tests/null_byte_1.phpt
+++ b/ext/oci8/tests/null_byte_1.phpt
@@ -35,9 +35,9 @@ var_dump($r);
--EXPECTF--
Test 1: Import
-Warning: OCILob::savefile(): Argument #1 ($function) must be a valid path, string given in %snull_byte_1.php on line %d
-NULL
+Warning: OCILob::savefile(): filename must not contain null bytes in /Users/cjones/php-src/ext/oci8/tests/null_byte_1.php on line %d
+bool(false)
Test 2: Export
-Warning: OCILob::export(): Argument #1 ($function) must be a valid path, string given in %snull_byte_1.php on line %d
-NULL
+Warning: OCILob::export(): filename must not contain null bytes in /Users/cjones/php-src/ext/oci8/tests/null_byte_1.php on line %d
+bool(false)