summaryrefslogtreecommitdiff
path: root/ext/odbc/php_odbc.c
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2019-08-28 17:51:57 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2019-08-28 17:55:15 +0200
commitb5572658166c4b8cbc1d332877a7a84c6e18a1c1 (patch)
treee350827fb032559f051e7cfff9c2cfaaa0684665 /ext/odbc/php_odbc.c
parent88ab3746278c1e52aaba4dce264ae61431f94024 (diff)
downloadphp-git-b5572658166c4b8cbc1d332877a7a84c6e18a1c1.tar.gz
Fix #78473: odbc_close() closes arbitrary resources
We have to bail out, if an invalid resource is given. For consistency with the other `zend_fetch_resource(2)` calls, we return `FALSE`.
Diffstat (limited to 'ext/odbc/php_odbc.c')
-rw-r--r--ext/odbc/php_odbc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index b5b8a07366..33233d24bd 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -2752,7 +2752,10 @@ PHP_FUNCTION(odbc_close)
return;
}
- conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn);
+ if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
+ RETURN_FALSE;
+ }
+
if (Z_RES_P(pv_conn)->type == le_pconn) {
is_pconn = 1;
}