cvs: php-src /ext/dbase dbase.c

From: Date: Thu, 24 Jan 2008 10:27:59 +0000
Subject: cvs: php-src /ext/dbase dbase.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-47961@lists.php.net to get a copy of this message
pollita Thu Jan 24 10:27:59 2008 UTC Modified files: /php-src/ext/dbase dbase.c Log: Fix potential crash when non-array is used optimisticly http://cvs.php.net/viewvc.cgi/php-src/ext/dbase/dbase.c?r1=1.90&r2=1.91&diff_format=u Index: php-src/ext/dbase/dbase.c diff -u php-src/ext/dbase/dbase.c:1.90 php-src/ext/dbase/dbase.c:1.91 --- php-src/ext/dbase/dbase.c:1.90 Mon Dec 31 07:12:08 2007 +++ php-src/ext/dbase/dbase.c Thu Jan 24 10:27:59 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dbase.c,v 1.90 2007/12/31 07:12:08 sebastian Exp $ */ +/* $Id: dbase.c,v 1.91 2008/01/24 10:27:59 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -270,6 +270,11 @@ } 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 @@ 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));

« previous php.cvs (#47961) next »