- MFH: Fixed bug #48240 (DBA Segmentation fault dba_nextkey)

This commit is contained in:
Felipe Pena 2009-05-13 02:14:53 +00:00
parent c25b0a2817
commit 539b7a2154
2 changed files with 26 additions and 1 deletions

View File

@ -219,7 +219,7 @@ DBA_NEXTKEY_FUNC(db4)
gkey.flags |= DB_DBT_MALLOC;
gval.flags |= DB_DBT_MALLOC;
}
if (dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT) == 0) {
if (dba->cursor && dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT) == 0) {
if (gkey.data) {
nkey = estrndup(gkey.data, gkey.size);
if (newlen) *newlen = gkey.size;

View File

@ -0,0 +1,25 @@
--TEST--
Bug #48240 (DBA Segmentation fault dba_nextkey)
--SKIPIF--
<?php
$handler = 'db4';
require_once('skipif.inc');
?>
--FILE--
<?php
$handler = 'db4';
require_once('test.inc');
$db = dba_open($db_filename, 'c', 'db4');
var_dump(dba_nextkey($db));
dba_close($db);
unlink($db_filename);
?>
===DONE===
--EXPECT--
bool(false)
===DONE===