From: Ilia Alshanetsky Date: Thu, 28 Aug 2003 00:33:48 +0000 (+0000) Subject: MFH: Fixed bug #25109 (Possible crash when fetching field names in pgsql) X-Git-Tag: php-4.3.4RC1~179 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=77005be6870ec7856130498fb7a3ebfcb38a48ab;p=php MFH: Fixed bug #25109 (Possible crash when fetching field names in pgsql) --- 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; }