From: Sara Golemon Date: Thu, 24 Jan 2008 10:27:59 +0000 (+0000) Subject: Fix potential crash when non-array is used optimisticly X-Git-Tag: RELEASE_2_0_0a1~797 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f035e7bb716d33275064837918dbfc132dec599;p=php Fix potential crash when non-array is used optimisticly --- 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));