summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJay Smith <jay@php.net>2003-04-17 16:55:56 +0000
committerJay Smith <jay@php.net>2003-04-17 16:55:56 +0000
commitbd62bcf18bba02e43a718e342925643de24368de (patch)
tree618a821d4f42493c33783c9566bc44570dd93322 /ext
parent42c98ab6c8cb8ecf0f818d2ac1e6368c4a4b60dc (diff)
downloadphp-git-bd62bcf18bba02e43a718e342925643de24368de.tar.gz
MFH: fix some segfaults in some pg_lo_* functions
Diffstat (limited to 'ext')
-rw-r--r--ext/pgsql/pgsql.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index ed54b149f1..e55e3cc525 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -1776,6 +1776,10 @@ PHP_FUNCTION(pg_lo_unlink)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires 1 or 2 arguments.");
RETURN_FALSE;
}
+
+ if (pgsql_link == NULL) {
+ RETURN_FALSE;
+ }
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
@@ -1845,6 +1849,10 @@ PHP_FUNCTION(pg_lo_open)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires 1 or 2 arguments.");
RETURN_FALSE;
}
+
+ if (pgsql_link == NULL) {
+ RETURN_FALSE;
+ }
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
@@ -2073,6 +2081,10 @@ PHP_FUNCTION(pg_lo_import)
else {
WRONG_PARAM_COUNT;
}
+
+ if (pgsql_link == NULL) {
+ RETURN_FALSE;
+ }
if (PG(safe_mode) &&(!php_checkuid(file_in, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;
@@ -2135,7 +2147,7 @@ PHP_FUNCTION(pg_lo_export)
CHECK_DEFAULT_LINK(id);
}
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
- "ss", &pgsql_link, &oid_string, &oid_strlen, &file_out, &name_len) == SUCCESS) {
+ "ss", &oid_string, &oid_strlen, &file_out, &name_len) == SUCCESS) {
oid = (Oid)strtoul(oid_string, &end_ptr, 10);
if ((oid_string+oid_strlen) != end_ptr) {
/* wrong integer format */
@@ -2167,6 +2179,10 @@ PHP_FUNCTION(pg_lo_export)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires 2 or 3 arguments.");
RETURN_FALSE;
}
+
+ if (pgsql_link == NULL) {
+ RETURN_FALSE;
+ }
if (PG(safe_mode) &&(!php_checkuid(file_out, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;