summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-08-28 00:33:48 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-08-28 00:33:48 +0000
commit77005be6870ec7856130498fb7a3ebfcb38a48ab (patch)
tree570b4b788a1abe560fa0564c388b7ead01537f4e
parentaef886e34c6ef772bafe49bd2e6826179211c735 (diff)
downloadphp-git-77005be6870ec7856130498fb7a3ebfcb38a48ab.tar.gz
MFH: Fixed bug #25109 (Possible crash when fetching field names in pgsql)
-rw-r--r--NEWS3
-rw-r--r--ext/pgsql/pgsql.c5
2 files changed, 6 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 540fcb64dc..803eed57cc 100644
--- a/NEWS
+++ b/NEWS
@@ -3,8 +3,9 @@ PHP 4 NEWS
?? ??? 2003, Version 4.3.4
- Fixed disk_total_space() and disk_free_space() under FreeBSD. (Jon Parise)
- Fixed crash bug when non-existing save/serializer handler was used. (Jani)
-- Fixed bug #25166 (WDDX serializer handler missing in win32). (Jani)
- Fixed bug #25239 (ftp_fopen_wrapper not RFC compliant). (Sara)
+- Fixed bug #25166 (WDDX serializer handler missing in win32). (Jani)
+- Fixed bug #25109 (Possible crash when fetching field names in pgsql). (Ilia)
25 Aug 2003, Version 4.3.3
- Upgraded the bundled Expat library to version 1.95.6. (Jani)
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 0f43f35dec..b2ab411f60 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -1093,7 +1093,10 @@ static char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list TSRMLS_DC)
char *tmp_oid, *end_ptr, *tmp_name;
list_entry new_oid_entry;
- if ((result = PQexec(pgsql,"select oid,typname from pg_type")) == NULL) {
+ if ((result = PQexec(pgsql,"select oid,typname from pg_type")) == NULL || PQresultStatus(result) != PGRES_TUPLES_OK) {
+ if (result) {
+ PQclear(result);
+ }
smart_str_free(&str);
return empty_string;
}