mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
- MFH: Fixed bug #48240 (DBA Segmentation fault dba_nextkey)
This commit is contained in:
parent
c25b0a2817
commit
539b7a2154
@ -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;
|
||||
|
25
ext/dba/tests/bug48240.phpt
Normal file
25
ext/dba/tests/bug48240.phpt
Normal 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===
|
Loading…
Reference in New Issue
Block a user