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));

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to