Skip to content

Commit 617698d

Browse files
chtgweltling
authored andcommitted
Fixed bug #70914 zend_throw_or_error() format string vulnerability
1 parent c2773ea commit 617698d

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Zend/tests/bug70914.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Bug #70895 null ptr deref and segfault with crafted callable
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded("pdo_sqlite")) {
6+
die("skip pdo_sqlite required");
7+
}
8+
?>
9+
--FILE--
10+
<?php
11+
12+
$db = new PDO('sqlite::memory:');
13+
$st = $db->query('SELECT 1');
14+
$re = $st->fetchObject('%Z');
15+
?>
16+
--EXPECTREGEX--
17+
Fatal error: Class '%Z' not found in .+bug70914.php on line \d+

Zend/zend_execute_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static void zend_throw_or_error(int fetch_type, zend_class_entry *exception_ce,
220220
if (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) {
221221
zend_throw_error(exception_ce, message);
222222
} else {
223-
zend_error(E_ERROR, message);
223+
zend_error(E_ERROR, "%s", message);
224224
}
225225

226226
efree(message);

0 commit comments

Comments
 (0)