summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2008-01-24 10:27:59 +0000
committerSara Golemon <pollita@php.net>2008-01-24 10:27:59 +0000
commit1f035e7bb716d33275064837918dbfc132dec599 (patch)
tree452d3b392ed65cc714364459b32b00b809f1830f
parent9b21430ee668f4c8fdf634db59946cee697c112d (diff)
downloadphp-git-1f035e7bb716d33275064837918dbfc132dec599.tar.gz
Fix potential crash when non-array is used optimisticly
-rw-r--r--ext/dbase/dbase.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/dbase/dbase.c b/ext/dbase/dbase.c
index ca19cb16fa..ad8be033bb 100644
--- a/ext/dbase/dbase.c
+++ b/ext/dbase/dbase.c
@@ -270,6 +270,11 @@ PHP_FUNCTION(dbase_add_record)
}
convert_to_long_ex(dbh_id);
+ if (Z_TYPE_PP(fields) != IS_ARRAY) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument two must be of type 'Array'");
+ RETURN_FALSE;
+ }
+
dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %ld", Z_LVAL_PP(dbh_id));
@@ -337,6 +342,11 @@ PHP_FUNCTION(dbase_replace_record)
convert_to_long_ex(dbh_id);
convert_to_long_ex(recnum);
+ if (Z_TYPE_PP(fields) != IS_ARRAY) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument two must be of type 'Array'");
+ RETURN_FALSE;
+ }
+
dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find database for identifier %ld", Z_LVAL_PP(dbh_id));