com php-src: fix NULL deref in pdo_firebird: ext/pdo_fi rebird/firebird_statement.c
| From: | Anatol Belski | Date: | Thu, 05 Nov 2015 21:11:00 +0000 |
| Subject: | com php-src: fix NULL deref in pdo_firebird: ext/pdo_fi rebird/firebird_statement.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89606@lists.php.net to get a copy of this message | ||
Commit: c1f893d894d00092aa839e236671a89948f5e431
Author: Anatol Belski <ab@php.net> Thu, 5 Nov 2015 22:11:00 +0100
Parents: cff9e16a124f84e8c03a7a4315c8e052db530d0c
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c1f893d894d00092aa839e236671a89948f5e431
Log:
fix NULL deref in pdo_firebird
ref #70862
Bugs:
https://bugs.php.net/70862
Changed paths:
M ext/pdo_firebird/firebird_statement.c
Diff:
diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c
index 1e0151d..5eaf530 100644
--- a/ext/pdo_firebird/firebird_statement.c
+++ b/ext/pdo_firebird/firebird_statement.c
@@ -523,12 +523,13 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct
pdo_bound_param_dat
}
if (Z_TYPE_P(parameter) == IS_RESOURCE) {
- php_stream *stm;
+ php_stream *stm = NULL;
php_stream_from_zval_no_verify(stm, parameter);
if (stm) {
+ zend_string *mem = php_stream_copy_to_mem(stm, PHP_STREAM_COPY_ALL, 0);
zval_ptr_dtor(parameter);
- ZVAL_STR(parameter, php_stream_copy_to_mem(stm, PHP_STREAM_COPY_ALL, 0));
+ ZVAL_STR(parameter, mem ? mem : STR_EMPTY_ALLOC());
} else {
pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream
resource");
return 0;