From 1f035e7bb716d33275064837918dbfc132dec599 Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Thu, 24 Jan 2008 10:27:59 +0000 Subject: [PATCH] Fix potential crash when non-array is used optimisticly --- ext/dbase/dbase.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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)); -- 2.50.1