Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ PHP NEWS
. Fixed bug GH-24350 (MINIT reads a stale external tz database after an
in-process module restart). (Lazizbek Ergashev)

- DBA:
. Fixed bug GH-24641 (ndbm handler does not check dbm_open() result).
(Lazizbek Ergashev)

- DOM:
. Fixed bug GH-23352 (UAF reading an attribute value node retained across
DOMDocument::adoptNode()). (David Carlier)
Expand Down
3 changes: 3 additions & 0 deletions ext/dba/dba_ndbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ DBA_OPEN_FUNC(ndbm)
}

dbf = dbm_open(ZSTR_VAL(info->path), gmode, filemode);
if (dbf == NULL) {
return FAILURE;
}

pinfo->dbf = dbf;
return SUCCESS;
Expand Down
22 changes: 22 additions & 0 deletions ext/dba/tests/gh24641.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
GH-24641 (ndbm handler does not check dbm_open() result)
--EXTENSIONS--
dba
--SKIPIF--
<?php
require_once __DIR__ . '/setup/setup_dba_tests.inc';
check_skip('ndbm');
?>
--FILE--
<?php
$file = __DIR__ . '/gh24641.db';
file_put_contents($file, 'not a valid ndbm database');
var_dump(dba_open($file, 'r', 'ndbm'));
?>
--CLEAN--
<?php
@unlink(__DIR__ . '/gh24641.db');
?>
--EXPECTF--
Warning: dba_open(): Driver initialization failed for handler: ndbm in %s on line %d
bool(false)
Loading