cvs: php4 /ext/pgsql pgsql.c

From: Date: Thu, 17 Apr 2003 16:54:43 +0000
Subject: cvs: php4 /ext/pgsql pgsql.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-20357@lists.php.net to get a copy of this message
jay Thu Apr 17 12:54:43 2003 EDT Modified files: /php4/ext/pgsql pgsql.c Log: Fix some segfaults in some of the pg_lo_* functions. Index: php4/ext/pgsql/pgsql.c diff -u php4/ext/pgsql/pgsql.c:1.269 php4/ext/pgsql/pgsql.c:1.270 --- php4/ext/pgsql/pgsql.c:1.269 Tue Apr 1 18:56:16 2003 +++ php4/ext/pgsql/pgsql.c Thu Apr 17 12:54:43 2003 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pgsql.c,v 1.269 2003/04/01 23:56:16 jay Exp $ */ +/* $Id: pgsql.c,v 1.270 2003/04/17 16:54:43 jay Exp $ */ #include <stdlib.h> @@ -1776,6 +1776,10 @@ 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_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 @@ 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 @@ 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_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; @@ -2204,7 +2220,7 @@ ZEND_FETCH_RESOURCE(pgsql, pgLofp *, &pgsql_id, -1, "PostgreSQL large object", le_lofp); - if (lo_lseek((PGconn *)pgsql->conn, pgsql->lofd, offset, whence ) > -1) { + if (lo_lseek((PGconn *)pgsql->conn, pgsql->lofd, offset, whence) > -1) { RETURN_TRUE; } else { RETURN_FALSE;

« previous php.cvs (#20357) next »